udevbe / greenfield

HTML5 Wayland compositor :seedling:
GNU Affero General Public License v3.0
901 stars 27 forks source link

Gstreamer variables missing (compositor-module) #98

Closed rosensvv closed 2 years ago

rosensvv commented 2 years ago

I am trying to create a Dockerfile for the compositor-module (it worked before), now there are a lot of new dependencies, I added most of them but I still get a gstreamer variables error. What is supposed to set these variables? This occurs during building:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/app/GSTREAMER_CONFIG_INCLUDE_DIRS
   used as include directory in directory /app
/app/GSTREAMER_INCLUDE_DIRS
   used as include directory in directory /app
GSTREAMER_APP_LIBRARIES (ADVANCED)
    linked by target "app-endpoint-encoding" in directory /app
GSTREAMER_CONFIG_LIBRARIES (ADVANCED)
    linked by target "app-endpoint-encoding" in directory /app
GSTREAMER_LIBRARIES (ADVANCED)
    linked by target "app-endpoint-encoding" in directory /app
GSTREAMER_VIDEO_LIBRARIES (ADVANCED)
    linked by target "app-endpoint-encoding" in directory /app
Zubnix commented 2 years ago

compositor-module shouldn't have any gstreamer dependencies (those should all be in compositor-proxy)

How are you building your docker image?

rosensvv commented 2 years ago

I am following the compositor-module instructions (yarn install, yarn build etc.). At some point I noticed it complained about missing something relate to compositor-proxy, so I copied that as well. Then all the trouble with dependencies began. Didn't use to be like this. This is my Dockerfile:

FROM node:16-buster-slim

RUN apt-get update && apt-get dist-upgrade -y \
    && apt-get install default-jre libffi-dev libglib2.0-dev libglib2.0-0 pkg-config python3 g++ cmake build-essential >    && apt-get autoremove -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY ["./compositor-module/*", "./"]
COPY ["./compositor-proxy", "./"]
RUN npm install -g cmake-js \
 && yarn install \
 && yarn build
CMD ["yarn", "demo"]
Zubnix commented 2 years ago

It seems you are mixing compositor-module and compositor-proxy which is possible but functionally not required. Could you tell me what you want to do or what your old setup was? Perhaps I can guide you to a better solution.

Some info: compositor-module is a web library that you need to integrate with your own site/web-app. You need a separate web server like nginx to make it work after packaging your site. An example of this is the demo implementation in the directory demo-compositor, which you can directly launch using yarn demo. It will package a website and spawn a (slower) development/demo web-server. This whole setup has no dependency or link to compositor-proxy.

compositor-proxy on the other hand runs entirely on it's own and functions as a 'fake' wayland compositor on the host. It has, in turn, no dependency on compositor-module. It purely functions as a gateway for the webapp to talk to native apps, but serves not webpages itself.

There is also a Dockerfile in compositor-proxy that should work, as well as a docker-compose.yml with a more extended setup with native apps.

rosensvv commented 2 years ago

That makes more sense now. I am actually working using your docker-compose, I'm just trying to create a all-in-one that would allow me to deploy the whole app - it used to work before (I had just created a Dockerfile for the demo implementation of the module) Now it gives me another error:

ERROR in ./src/WebFS.ts 17:0-48
Module not found: Error: Can't resolve './api' in '/app/src'
 @ ./src/RemoteSocket.ts 24:0-32 115:31-36
 @ ./src/index.ts 18:0-42 29:15-34 36:62-74
 @ ./demo-compositor/src/index.ts 1:0-125 4:10-18 7:26-49 34:25-53 35:37-67

ERROR in /app/src/RemoteSocket.ts
./src/RemoteSocket.ts 21:40-47
[tsl] ERROR in /app/src/RemoteSocket.ts(21,41)
      TS2307: Cannot find module './api' or its corresponding type declarations.
 @ ./src/index.ts 18:0-42 29:15-34 36:62-74
 @ ./demo-compositor/src/index.ts 1:0-125 4:10-18 7:26-49 34:25-53 35:37-67

ERROR in /app/src/WebFS.ts
./src/WebFS.ts 18:40-47
[tsl] ERROR in /app/src/WebFS.ts(18,41)
      TS2307: Cannot find module './api' or its corresponding type declarations.
 @ ./src/RemoteSocket.ts 24:0-32 115:31-36
 @ ./src/index.ts 18:0-42 29:15-34 36:62-74
 @ ./demo-compositor/src/index.ts 1:0-125 4:10-18 7:26-49 34:25-53 35:37-67
Zubnix commented 2 years ago

Ah yes, the compositor-module readme was missing a yarn generate. I've added it.

rosensvv commented 2 years ago

It requires java, maybe you should add it to the readme:

/app/node_modules/@openapitools/openapi-generator-cli/main.js:679
                error ? reject(new Error(stderr)) : resolve(stdout);
                               ^

Error: /bin/sh: 1: java: not found

    at /app/node_modules/@openapitools/openapi-generator-cli/main.js:679:32

Also, I get this error: "[warn] Did not found any file matching glob "../compositor-proxy/api.yaml"

Zubnix commented 2 years ago

Good catch about Java.

About the error. The missing file api.yaml is an openapi spec file that's probably outside your docker build context, hence docker can't access it when building. A quick fix is to simply copy this file to your compositor-module dir and change this line: https://github.com/udevbe/greenfield/blob/master/compositor-module/openapitools.json#L13 to "glob": "./api.yaml",

I'll see if I can make this more docker friendly.

rosensvv commented 2 years ago

Okay, it works now, even though there is an error in the proxy logs:

0:00:01.179264440     1 0x7f39e8003e30 ERROR                gldebug gstgldebug.c:307:_gst_gl_debug_callback:<glcontextegl0> high: GL error from API id:1, GL_INVALID_OPERATION in glDrawBuffer(invalid buffer GL_BACK)

I am trying to get this to work with traefik (https). I'm guessing the connection from the module to the proxy is done via the client machine (ie both the module and the proxy need to be proxied externally - they can't talk using docker overlay networking for example). Maybe that would be a consideration as you're making it more docker-friendly. Another thing I would like to do is define variables for the buttons (address, text, etc) and the resolution of the canvas in the Dockerfile/docker-compose.

Thanks for the help again!