-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[workaround] Docker Stack device mapping #2049
Comments
Could you make a pr for https://github.com/Koenkk/zigbee2mqtt.io/blob/master/docs/information/docker.md? |
Sure, please find it under #119 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This is not an error report, but a workaround for running zigbee2mqtt in a Docker Swarm environment using the
docker stack
command and might be considered to be added to the zigbee2mqtt documentation.Greets,
Ray
Docker Stack device mapping workaround
Docker stack doesn't support device mappings with option
--devices
when deploying a stack in Swam mode. A workaround is to bind the device as volume binding and set the right permissions.The workaround is based on the solution found at Add support for devices with "service create", all credits goes this him.
Identify cc2531 device
Identify the cc2531 device using the following command:
UDEV Rules
Create a new udev rule for cc2531,
idVendor
andidProduct
must be equal to values fromlsusb
command. The rule below creates device/dev/cc2531
:Reload newly created rule using the following command:
Create docker-setup-cc2531.sh
Copy the following content:
Set permissions:
Create docker-event-listener.sh
Copy the following content:
Set permissions:
Create docker-event-listener.service
Copy the following content:
[Unit] Description=Docker Event Listener for TI CC2531 device After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=1 User=root ExecStart=/bin/bash /usr/local/bin/docker-event-listener.sh [Install] WantedBy=multi-user.target
Set permissions:
Reload daemon
Start Docker event listener
Status Docker event listener
Enable Docker event listener
sudo systemctl enable docker-event-listener.service
Verify and deploy Zigbee2Mqtt stack
Now reconnect the cc2531. Verify using the following command:
lrwxrwxrwx 1 root root 7 Sep 28 21:14 /dev/cc2531 -> ttyACM0
Below an example of a
docker-stack-zigbee2mqtt.yml
:In the above example,
proxy_traefik-net
is the network to connect to the mqtt broker. The constraint makes sure Docker deploys only to this (rpi-3
) node, where the cc2531 is connected to. The volume binding/mnt/docker-cluster/zigbee2mqtt/data
is the zigbee2mqtt persistent directory, whereconfiguration.yaml
is saved.The zigbee2mqtt
configuration.yaml
should point to/dev/cc2531
:Deploy the stack:
The text was updated successfully, but these errors were encountered: