Blue/Green Deployment
Zero-downtime releases with instant rollback capability.
Overview
Blue/green deployment runs two identical production environments. Only one serves live traffic at any time. You deploy to the idle environment, validate it, then flip the router — cutting over all users simultaneously with zero downtime.
Architecture
Current production serving all traffic. Stable, known-good state.
New version deployed and validated. Ready for cutover.
Workflow
- 1Deploy new build to the idle (green) environment. Run smoke tests and health checks.
- 2Switch the load balancer or DNS record to point at green. Traffic shifts instantly.
- 3Monitor green for errors. If issues arise, flip back to blue in seconds.
- 4Once green is stable, blue becomes the new idle environment for the next release.
Database considerations
Both environments share the same database. Run migrations that are backward-compatible with the currently-active version. Never introduce breaking schema changes in a single deploy — use expand/contract patterns.
Pro tip: Keep the previous environment warm for at least one full monitoring cycle before decommissioning. Instant rollback is the superpower of this pattern.