This repository is useful if you
- Use docker compose to host docker containers in a Virtual Machine
- Use Nginx to route requests to different containers
- Want to achieve zero-downtime deployment in a simplest way
There are many solutions available for achieving zero-downtime deployment, but sometimes we just want a simple solution tailored to our specific use case.
While researching solutions for my use case, I came across this article to achieve it using only bash script, but it lacked a complete code example for implementation.
This repository aims to provide a comprehensive code example and guide on how to achieve zero-downtime deployment for a Docker Compose and Nginx project.
Check out my article for more details.
- Configure
docker-compose.yml
according to your need - In
upload_new_image.sh
, update the container name to your target container name. You can tailor the script any way you want, since the ultimate goal for this file is to prepare a docker image in the VM - In
deploy.sh
, updateservice_name
to your target container name - Upload
deploy.sh
,docker-compose.yml
andnginx.conf
to your VM - Run
chmod +x ./deploy.sh
to make it executable - Run
./deploy.sh
to start the deployment