Docker-stack-deploy: background and use
Since its release in 2013, Docker has proven to be a reliable open platform for developers, revolutionizing the entire software industry. Its accessibility for developers and the ability for rapid deployment have made Docker one of the most popular platforms, with over 3 million installations and tens of thousands of companies utilizing it.
While Kubernetes is all the rage, Docker Swarm Mode remains a good choice for deployments, especially in smaller environments. The reason for this is its simplicity.
Evolution of Docker:
At Neuroforge, we believe that simplifying the lives of the community benefits everyone. As Docker Swarm Mode has some minor weaknesses, we have decided to develop a wrapper that makes Docker even more automated and user-friendly.
Allow me to introduce: docker-stack-deploy for Docker Swarm.
Docker stack files are a great way to organize your deployments. However, the issue is that Docker Swarm does not allow changes to secrets and configs. This means that you have to manually rotate the configs/secrets yourself.
Docker-stack-deploy is a small Python script that encapsulates the actual docker stack deploy command and intercepts all stack files in the arguments, rewriting them to automatically rotate configs and secrets when the content of the referenced files has changed.
To use it, simply write instead of "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 has given us some automation headaches. We build some of our internal tools and app deployments on Docker Swarm because the barrier to entry is very low. The main clustering concepts are the same across all major container orchestrators. When using our setup, we also took older tutorials and versions for Docker Swarm mode and modernised them on GitHub. For example, see our modernised Swarmprom for cluster monitoring here:
2) Is there another solution?
Another clever solution people have come up with is to append the secret/config hashcode via an env var in the stack file. However, this requires the deployment script to be manually wrapped in a process that generates this hash. With docker-stack-deploy, this is no longer required.
3) Does it support multiple stack files?
Sure. It also supports multiple stack files and rewrites all files passed to the command line.