Blue-green deployment
Releasing a new version next to the old one and switching traffic over at once.
A blue-green deployment is a way to release new software with almost no downtime. You keep two identical production environments. One, say blue, is serving users with the current version. You install the new version on the other, green, test it there with real infrastructure, and when it looks good you flip the switch: the load balancer or DNS starts sending all traffic to green.
The big advantage is the way back. If something breaks after the switch, you flip traffic back to blue, which is still running the old version untouched. Rolling back takes seconds instead of a frantic redeploy. Once green has proven itself, blue becomes the place where the next release is prepared.
The price is running two copies of everything for a while, and the database is the tricky part: both versions usually share it, so changes to its structure have to work for the old and the new code at the same time. A close cousin is the canary release, which moves a small share of users first instead of everyone at once. Cloud tools like AWS CodeDeploy and Kubernetes support both patterns.
Keep in mind
- Two identical environments: one live, one with the new version.
- Traffic is switched all at once, usually at the load balancer or DNS.
- Rolling back is just switching back.
- Costs double capacity for a while, and database changes need care.
Go deeper
- BlueGreenDeployment (Martin Fowler)
- Blue/green deployments (AWS whitepaper)
- Blue–green deployment on Wikipedia