Automate synchronization of Docker Swarm services with Doppler.
If you use Docker Swarm, you may have encountered the need to store your configuration somewhere and gracefully restart your services when configuration changes. We use Doppler. Unfortunately, Doppler doesn't offer native support for Docker Swarm out of the box. This tool bridges that gap by providing a seamless integration between Docker Swarm and Doppler.
This tool uses a specific Doppler API that enables it to subscribe to configuration changes. Please note that this API is available on Team and Enterprise plans only. For more details, refer to the Doppler documentation on automatic restart.
-
Please, take into account that this tool rewrites your docker service env vars completely. Do not add any env var to your docker service manually since they will be rewritten.
-
Setup alerts on errors in logs. Configuration is important.
- Configure
config.json
with Doppler tokens and Docker service names. Take a look at example configuration. watcher is a single process that subscribes to Doppler and listens for changes in environment. - Store
config.json
on one of your docker swarm manager hosts somewhere (for example, at/etc/doppler-swarm/config.json
). - Create a Docker service bound to the manager host (replace
myhostname1
with the actual hostname):Ensure that the service is started by a user with write access to /var/run/docker.sock.docker service create \ --user root \ --mount type=bind,source=/etc/doppler-swarm/config.json,target=/app/config.json \ --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \ --name doppler-swarm \ --constraint "node.role==manager" \ --constraint "node.hostname==myhostname1" \ whop/doppler-swarm:latest \ /app/doppler-swarm /app/config.json
- Check the logs for any errors:
docker service logs doppler-swarm
Feel free to create a new issue if you have suggestions, found any errors, or need assistance.
Come join us :)