Prompt
blue green deployment with rollback and approvals
Latest observation
Oct 19, 2026
OpenAI APIWeb search: off
Here’s a practical blue-green deployment with rollback and approvals pattern you can use in most CI/CD systems.
Concept
- Blue = current production environment
- Green = new version deployed alongside blue
- You deploy to green, test it, get approval, then switch traffic from blue → green
- If something goes wrong, you rollback by switching traffic back to blue
Typical flow
-
Build artifact
- Build once, promote the same artifact through environments.
-
Deploy to green
- Provision/update the green environment with the new version.
- Keep blue serving live traffic.
-
Run validation
- Smoke tests
- Integration tests
- Health checks
- Optional canary-like checks on green before cutover
-
Manual approval gate
- Require a human approval before traffic cutover.
- Useful for production release control.
-
Cutover
- Switch load balancer / DNS / ingress / service selector from blue to green.
-
Monitor
- Watch error rates, latency, and business metrics.
-
Rollback if needed
- If issues occur, switch traffic back to blue.
- Since blue was untouched, rollback is fast.
Rollback strategy
Rollback in blue-green is usually:
- Instant traffic switch back
- No redeploy needed if blue is still healthy
- Keep blue intact until green is proven stable
Recommended:
- Define automatic rollback triggers:
- 5xx error rate above threshold
- latency spike
- failed health checks
- Keep rollback manual too, if you want approval for reverting production traffic
Approval design
Common approval points:
- Pre-production approval: before deploying to green in staging-like environment
- Production cutover approval: before switching traffic
- Rollback approval: optional, if your org requires it
Good approval policies:
- Require at least one approver from ops/release team
- Require two approvals for high-risk services
- Add release notes, change ticket, and test evidence in the approval request
Example pipeline stages
- Build
- Unit tests
- Deploy to green
- Smoke tests on green
- Manual approval
- Switch traffic to green
- Post-deploy verification
- Rollback if verification fails
Example implementation ideas
Load balancer based
- Blue and green are two separate target groups
- Change listener rules to point to green
- Rollback = point back to blue
Kubernetes based
- Two deployments:
app-blueapp-green
- Service selector changes from blue labels to green labels
- Rollback = revert selector
DNS based
- Route 53 / DNS record updated to green endpoint
- Rollback = revert DNS
- Slower than LB switch because of TTL
Best practices
- Use health checks before cutover
- Keep database migrations backward compatible
- Avoid breaking schema changes during cutover
- Keep feature flags for risky features
- Tag releases and store artifact versions
- Add observability dashboards before deployment
- Use automatic rollback where possible
Example approval + rollback policy
- Deploy green automatically after tests
- Require approval to cut over traffic
- After cutover, monitor 10–15 minutes
- If:
- error rate > 2%
- p95 latency > 2x baseline
- critical logs appear
- then rollback automatically or request approval to rollback
If you want, I can also provide:
- a GitHub Actions / GitLab CI / Azure DevOps pipeline example, or
- a Kubernetes blue-green deployment YAML with approval and rollback flow.