Docs / Cloud & DevOps / Blue-Green and Canary Deployment Strategies

Blue-Green and Canary Deployment Strategies

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 30 views · 1 min read

Blue-Green Deployment

Maintain two identical production environments. Only one (blue) serves traffic at a time. Deploy to the inactive one (green), test it, then switch traffic.

How It Works

  1. Blue environment serves production traffic
  2. Deploy new version to Green environment
  3. Test Green thoroughly
  4. Switch load balancer/DNS from Blue to Green
  5. Green is now production; Blue becomes the rollback target

Nginx Implementation

# Switch between backends
upstream backend {
    server 127.0.0.1:3001;  # Blue (active)
    # server 127.0.0.1:3002;  # Green (standby)
}

# To switch: comment Blue, uncomment Green, reload nginx

Canary Deployment

Route a small percentage of traffic to the new version. If metrics look good, gradually increase.

# Nginx weighted upstream
upstream backend {
    server 127.0.0.1:3001 weight=9;  # Old version (90%)
    server 127.0.0.1:3002 weight=1;  # New version (10%)
}

Comparison

  • Blue-Green: instant switch, easy rollback, requires 2x resources
  • Canary: gradual rollout, lower risk, catches issues early with small impact
  • Rolling: update instances one at a time, no extra resources needed

Was this article helpful?