Architecture Intermediate
Blue-Green Deployment¶
Blue-GreenDeploymentZero Downtime 3 min read
Zero-downtime release using two identical environments.
Principle¶
Two identical environments: Blue (current) and Green (new version). Deploy to Green, test, switch traffic.
# Before: LB → Blue (v1.0)
# Deploy to Green (v2.0), test
# Switch: LB → Green (v2.0)
# Rollback? LB → Blue (v1.0)
Configuration¶
# Switch with a single line
upstream app {
# server blue-pool:8080; # Comment out to switch
server green-pool:8080;
}
Pros and Cons¶
- Zero downtime
- Instant rollback
- Double the infrastructure
- Database migrations require attention
Summary¶
The simplest zero-downtime deployment. Double the infrastructure is the price for safety.
Need Help with Implementation?¶
Our team has experience designing and implementing modern architectures. We’re happy to help.