An implementation of zero downtime deployment pattern using Traefik priority
- docker
- curl
Init cluster and create network
docker swarm init
docker network create -d overlay front-network
git clone https://github.com/rodolpheche/bluegreen-traefik-docker
cd bluegreen-traefik-docker
docker stack deploy -c stacks/docker-stack-http.yml http
Access http://127.0.0.1:8080 to display Traefik UI
docker stack deploy -c stacks/docker-stack-appli-blue.yml appli-blue
Access http://127.0.0.1 to display Blue version
./bin/check-no-downtime.sh
docker stack deploy -c stacks/docker-stack-appli-green.yml appli-green
docker service update --label-add "traefik.http.routers.colors-green.priority=100" appli-green_colors
docker service update --label-add "traefik.http.routers.colors-blue.priority=0" appli-blue_colors
Access http://127.0.0.1 to display green version
docker stack rm http appli-green appli-blue