Nibelungenstraße 7 |  95444 Bayreuth | Germany   
+49 921 788989 99
NF AI
NF Compose
Career
About us
November 17, 2022

Docker-stack-deploy: Background and usage

Since its release in 2013, Docker has proved to be a reliable open platform for developers and became a revolutionizer of the whole software industry. The accessibility for developers and possibility of rapid deployments made Docker one of the most popular platforms, with over 3 million installations and tens of thousands of companies using it.

Even though there is a lot of buzz around Kubernetes, Docker Swarm (mode) is still a reasonable choice for deployments - especially in smaller scale setups. The reason is its simplicity.

We at Neuroforge believe that making the communities' life easier will benefit everyone. As Docker Swarm mode has some smaller rough edges, we decided to create a utility that makes Docker more automated and even more user-friendly.

May I present: docker-stack-deploy für Docker Swarm

Docker Stack files are a great way to organize your deployments. The problem is, though, that Docker Swarm does not allow changes in secrets and configs. This means that you have to manually rotate configs/secrets yourself.

docker-stack-deploy is a small python script that wraps around the actual docker stack deploy command and intercepts any stack files in the arguments by rewriting them in a way that automatically rotates configs and secrets if the content of the referenced files has changed.

To use it, just write docker stack deploy:

docker-sdp stack deploy

FAQ about docker-stack-deploy

1) What was the idea behind docker-stack-deploy?

This tool is a layer around docker stack deploy that caused us some headaches for automation. We are building some of our internal tooling and app deployments around Docker Swarm due to the low barrier for entry. The main clustering concepts are the same between all the major container orchestrators. While using our setup, we also took older tutorials and versions for Docker Swarm mode and modernized them on our GitHub. For example, see our modernized swarmprom for cluster monitoring here: https://github.com/neuroforgede/swarmsible-stacks/tree/main/02_monitoring

2) Is there any other solution?

Another smart solution people have come up with is appending the hashcode of the secret/config via an env var in the stack file. This however requires manually wrapping the deployment script in a process that generates this hash. With docker-stack-deploy, this is not required anymore.

3) Does it supports multiple stack files (inheritance)?

Sure! It also supports multiple stack files and rewrites all files passed to the command line.

Privacy policyImprint
en_USEnglish
Cookie Consent Banner by Real Cookie Banner linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram