Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zwavejsui-ui container not started automatically (RPI) #3646

Closed
hvoorend opened this issue Mar 26, 2024 · 8 comments
Closed

Zwavejsui-ui container not started automatically (RPI) #3646

hvoorend opened this issue Mar 26, 2024 · 8 comments
Assignees
Labels
question Further information is requested

Comments

@hvoorend
Copy link

My MQTT-, zwavejsui-ui-, Domoticz-package runs perfectly fine and I’m happy with it. The only thing now is: my Mosquitto container is automatically started by docker-compose at RPI startup (after reboot or power on) but my zwavejs-ui container is not. I have to start it manually from /opt/zwavejs-ui/ with docker-compose up -d every time after power off/on or reboot. How can I make the zwavejsui-ui container auto start?
This is my docker-compose.yml:
pi@raspberrypi:/opt/zwavejs-ui $ cat docker-compose.yml version: "3.7" services: zwave-js-ui: container_name: zwave-js-ui image: zwavejs/zwave-js-ui:latest restart: unless-stopped tty: true stop_signal: SIGINT environment: - SESSION_SECRET=mySecretSession - TZ=Europe/Amsterdam devices: - '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave' volumes: - ./store:/usr/src/app/store ports: - "8091:8091" # port for web interface - "3000:3000" # port for Z-Wave JS websocket server

This is my Mosquitto docker-compose.yaml
`pi@raspberrypi:/opt/mosquitto $ cat docker-compose.yaml
services:
mosquitto:
restart: unless-stopped
build:
context: .
volumes:
- type: bind
source: ./config/
target: /mosquitto/config/
- type: bind
source: ./log/
target: /mosquitto/log/
- type: volume
source: data
target: /mosquitto/data/
ports:
- target: 1883
published: 1883
protocol: tcp
mode: host
- target: 9001
published: 9001
protocol: tcp
mode: host

volumes:
data:
name: "mqtt-broker-data" `

@hvoorend hvoorend added the question Further information is requested label Mar 26, 2024
@hvoorend
Copy link
Author

hvoorend commented Mar 26, 2024

Apologies that I lost the formatting in the initial post. Here a retry:
My MQTT-, zwavejsui-ui-, Domoticz-package runs perfectly fine and I’m happy with it. The only thing now is: my Mosquitto container is automatically started by docker-compose at RPI startup (after reboot or power on) but my zwavejs-ui container is not. I have to start it manually from /opt/zwavejs-ui/ with docker-compose up -d every time after power off/on or reboot. How can I make the zwavejsui-ui container auto start?

This is my docker-compose.yml:

pi@raspberrypi:/opt/zwavejs-ui $ cat docker-compose.yml
version: "3.7"
services:
  zwave-js-ui:
    container_name: zwave-js-ui
    image: zwavejs/zwave-js-ui:latest
    restart: unless-stopped
    tty: true
    stop_signal: SIGINT
    environment:
      - SESSION_SECRET=mySecretSession
      - TZ=Europe/Amsterdam
    devices:
      - '/dev/serial/by-id/usb-0658_0200-if00:/dev/zwave'
    volumes:
      - ./store:/usr/src/app/store
    ports:
      - "8091:8091" # port for web interface
      - "3000:3000" # port for Z-Wave JS websocket server 

This is my Mosquitto docker-compose.yaml:

pi@raspberrypi:/opt/mosquitto $ cat docker-compose.yaml
services:
  mosquitto:
    restart: unless-stopped
    build:
      context: .
    volumes:
      - type: bind
        source: ./config/
        target: /mosquitto/config/
      - type: bind
        source: ./log/
        target: /mosquitto/log/
      - type: volume
        source: data
        target: /mosquitto/data/
    ports:
      - target: 1883
        published: 1883
        protocol: tcp
        mode: host
      - target: 9001
        published: 9001
        protocol: tcp
        mode: host

volumes:
  data:
    name: "mqtt-broker-data" 

@robertsLando
Copy link
Member

@hvoorend I don't see any issue on your docker-compose file, did you try to check if on boot there is any error that prevents the container to start for some reason? Because AFAIK starting it with docker-compose up -d is enough (I always used that command and it always worked for me to start the container on boot). The alternative could be to put a script that runs the compose up command on boot like for example in rc.local but that's not ideal

@hvoorend
Copy link
Author

Thanks Robert, good to know that docker-compose up -d should be enough. I will go through my logs and see if I can find any issues.

@robertsLando
Copy link
Member

Ok let me know 🙏🏼

@hvoorend
Copy link
Author

Will sure do. Pls. allow me to find a bit of time to do my investigation.

@hvoorend
Copy link
Author

I've found this post that helped me out: [https://stackoverflow.com/questions/64644587/containers-not-restarted-after-update-with-restart-always-in-docker-compose-yml].
I checked the Restart Policy for my container called "zwave-js-ui". It told me: "Name": "unless-stopped". This is almost simular to restart always, BUT... if one stops the container (manually or otherwise), docker will no longer automatically start it (docker says: ok, you want to stop it, probably you know better then I do (or will have your good reasons), so I will keep my hands off until I'm instructed differently").
So I must have stopped it manually some time in my Domoticz upgrade process to MQTT/zwave-js-ui. Can't recall.

``` root@raspberrypi:~# docker inspect zwave-js-ui | grep -i restart -A 5
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 18334,
            "ExitCode": 0,
            "Error": "",
--
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
--
            "RestartPolicy": {
                "Name": "unless-stopped",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",

So I've updated the Restart Policy for my container with: docker update zwave-js-ui --restart always
Redisplaying the Restart Policy now showed: "Name": "always"  (see below).
Rebooted and all came up automatically. Same for power off/on. Issue solved. 
Good learning experience. Hope this explanation will help someone if he/she runs into this issue. 

/root@raspberrypi:~# docker inspect zwave-js-ui | grep -i restart -A 5
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 18334,
            "ExitCode": 0,
            "Error": "",
--
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
--
            "RestartPolicy": {
                "Name": "always",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",

@hvoorend
Copy link
Author

The "unless-stopped" is also in both YML files for the MQTT and the zwave-js-ui container. So I could change this to "always". But with above knowledge it can be more handy to keep it on unless-stopped in the yml's for now.

@robertsLando
Copy link
Member

So I must have stopped it manually some time in my Domoticz upgrade process to MQTT/zwave-js-ui. Can't recall.

It could be. So I can close this, right? Feel free to reopen in case

@zwave-js zwave-js locked and limited conversation to collaborators Apr 2, 2024
@robertsLando robertsLando converted this issue into discussion #3653 Apr 2, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants