Blue-Green Deployment — Explained with Examples
Blue-green deployment is a release technique that reduces downtime and risk by running two identical production environments, referred to as Blue and Green. At any time, only one environment serves live production traffic.
When you deploy a new version, you deploy it to the idle environment (say, Green). After smoke tests pass, you switch the router or load balancer to direct all traffic to Green. If something goes wrong, you flip back to Blue instantly. This makes rollbacks trivial: just switch traffic again. The environments are fully provisioned with their own databases, caches, and compute resources.
Real-world analogy. Blue-green deployment is like having two identical bridges across a river. Traffic flows on Blue Bridge. You build a new Green Bridge next to it. Once Green Bridge is ready and tested, you put up a sign that moves all traffic to Green. If Green develops a crack, you move traffic back to Blue.
Example traffic switch (NGINX):
upstream backend {
server blue.example.com weight=100;
server green.example.com weight=0;
}
# After deploy to green:
upstream backend {
server blue.example.com weight=0;
server green.example.com weight=100;
}Related terms: Canary Deployment, CI/CD, Zero Downtime Deployment, Immutable Infrastructure, Orchestration
Related tutorial: Blue-Green Deployment Strategy
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro