werthdavid / homebridge-website-to-camera

Homebridge plugin that displays a Website as virtual camera (intended for Google Maps Traffic)
MIT License
54 stars 7 forks source link

Using plugin in Docker (OZNU Homebridge) #50

Open harryslapalot opened 1 year ago

harryslapalot commented 1 year ago

I would like to use your plugin in my homebridge environment since it delivers exactly what I have been looking for for a long time. Unfortunately, I run homebridge in a docker container which seems to make it a bit more complicated. I already read a lot and added

apt-get update apt-get install -y chromium-browser

to startup.sh chromium-browser obviously got installed.

When I start the camera feed in homekit, I get this error in the homebridge log:

` 2023-04-25T22:17:43.743945808Z stdout at processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-04-25T22:17:43.743924898Z stdout at endReadableNT (node:internal/streams/readable:1359:12)
2023-04-25T22:17:43.743906757Z stdout at Socket.emit (node:events:525:35)
2023-04-25T22:17:43.743883987Z stdout at Socket.onend (node:internal/readline/interface:259:10)
2023-04-25T22:17:43.743852127Z stdout at Interface.close (node:internal/readline/interface:533:10)
2023-04-25T22:17:43.743830957Z stdout at Interface.emit (node:events:525:35)
2023-04-25T22:17:43.743800986Z stdout at Interface. (/homebridge/node_modules/homebridge-website-to-camera/node_modules/puppeteer-core/src/node/BrowserRunner.ts:254:50)
2023-04-25T22:17:43.743769836Z stdout at onClose (/homebridge/node_modules/homebridge-website-to-camera/node_modules/puppeteer-core/src/node/BrowserRunner.ts:268:9)
2023-04-25T22:17:43.743754006Z stdout  
2023-04-25T22:17:43.743724065Z stdout TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2023-04-25T22:17:43.743706345Z stdout  
2023-04-25T22:17:43.743691525Z stdout  
2023-04-25T22:17:43.743676515Z stdout  
2023-04-25T22:17:43.743654655Z stdout snap install chromium
2023-04-25T22:17:43.743633754Z stdout  
2023-04-25T22:17:43.743610494Z stdout Please install it with:
2023-04-25T22:17:43.743578234Z stdout Command '/usr/bin/chromium-browser' requires the chromium snap to be installed.
2023-04-25T22:17:43.743547524Z stdout  
2023-04-25T22:17:43.743430252Z stdout [4/26/2023, 12:17:43 AM] [website-camera] Error: Failed to launch the browser process!
2023-04-25T22:17:43.736142063Z stdout [4/26/2023, 12:17:43 AM] [website-camera] Starting new instance of Chromium: /usr/bin/chromium-browser
2023-04-25T22:17:41.527698583Z stdout at processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-04-25T22:17:41.527676613Z stdout at endReadableNT (node:internal/streams/readable:1359:12)
2023-04-25T22:17:41.527655382Z stdout at Socket.emit (node:events:525:35)
2023-04-25T22:17:41.527629062Z stdout at Socket.onend (node:internal/readline/interface:259:10)
2023-04-25T22:17:41.527594372Z stdout at Interface.close (node:internal/readline/interface:533:10)
2023-04-25T22:17:41.527515511Z stdout at Interface.emit (node:events:525:35)
2023-04-25T22:17:41.527483640Z stdout at Interface. (/homebridge/node_modules/homebridge-website-to-camera/node_modules/puppeteer-core/src/node/BrowserRunner.ts:254:50)
2023-04-25T22:17:41.527452460Z stdout at onClose (/homebridge/node_modules/homebridge-website-to-camera/node_modules/puppeteer-core/src/node/BrowserRunner.ts:268:9)
2023-04-25T22:17:41.527432590Z stdout  
2023-04-25T22:17:41.527402010Z stdout TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2023-04-25T22:17:41.527383759Z stdout  
2023-04-25T22:17:41.527366879Z stdout  
2023-04-25T22:17:41.527347799Z stdout  
2023-04-25T22:17:41.527324089Z stdout snap install chromium
2023-04-25T22:17:41.527306079Z stdout  
2023-04-25T22:17:41.527275728Z stdout Please install it with:
2023-04-25T22:17:41.527240918Z stdout Command '/usr/bin/chromium-browser' requires the chromium snap to be installed.
2023-04-25T22:17:41.527212967Z stdout  
2023-04-25T22:17:41.527090886Z stdout [4/26/2023, 12:17:41 AM] [website-camera] Error: Failed to launch the browser process!
2023-04-25T22:17:41.493219878Z stdout [4/26/2023, 12:17:41 AM] [website-camera] Starting new instance of Chromium: /usr/bin/chromium-browser

`

Any ideas how I can get chromium installed correctly? I tried putting "snap install chromium" in shartup.sh, that didn't work.

werthdavid commented 1 year ago

I guess the Docker base image uses ubuntu? Well, so the message clearly indicates that the installation should happen via snap. Is there any error when you run the snap install?

harryslapalot commented 1 year ago

No, there's no error in the log. But from what I've read I understand that snap is not supported with Ubuntu in Docker. I am now trying a different route. There's a chromium beta available without snap, but I didn't yet succeed installing it since add-apt-repository is not part of the OZNU homebridge docker file. I will let you know if I succeed. If you or anyone else has another idea I would very much appreciate it!

werthdavid commented 1 year ago

After consulting google for a while it could be an option to port-forward 9222 if it is an option to run chromium somewhere outside the homebridge container. Not sure if it really works though

harryslapalot commented 1 year ago

Ok. I really don't know how to setup a port forwarding from inside the container to another target. Only option would be to run a separate container in docker with chromium on it.