Back to docs
Recipe

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

Blue (active)

Current production serving all traffic. Stable, known-good state.

Green (staging)

New version deployed and validated. Ready for cutover.

Workflow

  1. 1Deploy new build to the idle (green) environment. Run smoke tests and health checks.
  2. 2Switch the load balancer or DNS record to point at green. Traffic shifts instantly.
  3. 3Monitor green for errors. If issues arise, flip back to blue in seconds.
  4. 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.