Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Zero-Downtime Deployments with Docker Compose (maxcountryman.com)
40 points by todsacerdoti on April 21, 2023 | hide | past | favorite | 7 comments


This is brilliant for smaller projects/ small teams that don't want to carry Kubernetes' overhead. Thanks a lot for the writeup! <3


This is actually something that is easier and more scalable to do with Kubernetes, IMO.

You would declare your app in a Kubernetes Deployment load balanced by a Kubernetes Service and configure to use the Traefik ingress controller.

You would apply two deployments, one for the blue side and the other for the green side. You would use annotations for this.

Initially, the Service will be configured to only front Pods that are on the blue side.

Deploy the deployment.

When you're ready to ship a new version of the app, build a new container image and push it into your container registry. Once that's done, update the green side with the new image, then update the Service to front green Pods instead of blue ones.

The cutover will be immediate.

Kubernetes also supports other deployment models, including a Rolling deployment, which allows you to slowly bleed traffic onto new versions while keeping the old version up and scaling down appropriately.


Can all of this be done on a single machine though? For a small hobby project for instance, docker-compose can handle everything on a single machine. With Kubernetes, don't you need multiple nodes?


100%. You can run Kubernetes on your computer with minikube, kind, or even Docker Desktop!


"Blue-green deployment" seems to be another phrase for hot-warm installations which can use DNS-switching (or other means) for rollbacks. Or am I missing something?

Still like the write-up, even if not using Traefik.


Blue-green terminology was made famous by Martin Fowler in 2010 with this post[0].

[0] https://martinfowler.com/bliki/BlueGreenDeployment.html


Thanks for the info/material, kind Internet person :-).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: