zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
987 stars 201 forks source link

Launch on Boot #2519

Closed markolbert closed 2 years ago

markolbert commented 2 years ago

Apologies for what may well be a docker question rather than a zwavej22mqtt question...

I am running HomeAssistant in a docker container. It launches on boot (Raspberry Pi 4, latest 64 bit Raspbian).

However, I have not been able to figure out how to get zwavejs2mqtt to launch on boot as well. I have to do a docker run for it.

I tried adapting the default docker script (using local folder persistence) to match how HomeAssistant was set up for its container:

sudo docker run -d \
    --name zwavejs \
    -p 8091:8091 \
    -p 3000:3000 \
    --device=/dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_22bb70947894eb11b4af39703d98b6d1-if00-port0:/dev/zwave \
    -v /zwavejs/store:/usr/src/app/store \
    zwavejs/zwavejs2mqtt:latest

However, this didn't work -- zwavejs2mqtt does not launch on reboot.

Any tips or leads would be appreciated.

markolbert commented 2 years ago

Apparently I didn't initially properly duplicate the HomeAssistant container configuration. The following works, and launches on reboot:

docker run -d \
    --name zwavejs \
    --restart=unless-stopped \
    -p 8091:8091 \
    -p 3000:3000 \
    --device=/dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_22bb70947894eb11b4af39703d98b6d1-if00-port0:/dev/zwave \
    -v /zwavejs/store:/usr/src/app/store \
    zwavejs/zwavejs2mqtt:latest

I thought the --restart option only affected what docker does if the container crashes while running. But apparently it also defines what to do on boot.

robertsLando commented 2 years ago

I usually prefer to use docker-compose for this 😊