Blue Green Streamlined
Boost productivity using this implement, blue, green, deployment. Includes structured workflows, validation checks, and reusable patterns for deployment.
Blue Green Streamlined
Implement blue-green deployment with automated traffic switching, health validation, and instant rollback capability.
When to Use This Command
Run this command when you need to:
- Deploy a new application version alongside the current one and switch traffic with zero downtime
- Validate a new deployment against health checks and smoke tests before exposing it to users
- Roll back instantly to the previous version by switching traffic back to the original environment
Consider alternatives when:
- You want gradual traffic shifting (use canary deployment instead)
- Your application cannot run two versions simultaneously due to database schema incompatibility
Quick Start
Configuration
name: blue-green-streamlined type: command category: deployment
Example Invocation
claude command:run blue-green-streamlined --version v2.1.0 --target green --platform k8s
Example Output
[Detect] Current active: BLUE (v2.0.0) | Idle: GREEN
[Deploy] Deploying v2.1.0 to GREEN environment...
Image: myapp:v2.1.0 pulled (234 MB)
Pods: 3/3 ready (42s)
[Validate] Running health checks on GREEN...
/health: 200 OK (45ms)
/ready: 200 OK (38ms)
Smoke tests: 12/12 passed
[Switch] Routing traffic from BLUE to GREEN...
Load balancer updated: 100% traffic -> GREEN
DNS propagation: confirmed (2s)
[Monitor] Watching error rates for 60s...
Error rate: 0.02% (baseline: 0.03%) -- OK
[Complete] GREEN (v2.1.0) is now active
[Rollback] To revert: claude command:run blue-green-streamlined --rollback
Core Concepts
Blue-Green Deployment Overview
| Aspect | Details |
|---|---|
| Environments | Two identical environments (Blue and Green) alternating as active/idle |
| Traffic Switch | Atomic swap via load balancer, DNS, or Kubernetes service selector |
| Validation | Health checks, smoke tests, and error rate monitoring before switch |
| Rollback | Instant revert by switching traffic back to the previous environment |
Deployment Workflow
[BLUE = Active] [GREEN = Idle]
|
[Deploy new version to GREEN]
|
[Health checks + smoke tests]
|
[Switch traffic: BLUE -> GREEN]
|
[Monitor error rates]
/ \
OK Problem
| |
[GREEN=Active] [Rollback to BLUE]
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| version | string | required | Application version tag to deploy |
| target | string | auto | Target environment: blue or green (auto-selects idle) |
| platform | string | k8s | Deployment platform: k8s, docker-swarm, ecs, or nginx |
| monitor-duration | number | 60 | Seconds to monitor error rates after traffic switch |
| rollback | boolean | false | Revert to the previously active environment |
Best Practices
-
Validate Exhaustively Before Switching - Run comprehensive health checks, smoke tests, and integration tests against the idle environment before routing any user traffic. The cost of validation is always less than the cost of a bad deployment.
-
Monitor After Switch, Not Just Before - Error rates may spike only after real user traffic hits the new version. Watch metrics for at least 60 seconds after the switch before declaring success.
-
Keep Both Environments Running Post-Switch - Do not tear down the old environment immediately. Keep it running for at least one business cycle (24 hours) to enable instant rollback if delayed issues surface.
-
Ensure Database Compatibility - Both blue and green must work against the same database. Design migrations to be backward-compatible so the old version continues to function during the transition window.
-
Automate the Entire Flow - Manual traffic switching introduces human error. Script the deploy-validate-switch-monitor pipeline end-to-end and only intervene on failure.
Common Issues
-
Session Stickiness Breaks After Switch - User sessions tied to the old environment lose state after traffic moves. Use external session storage (Redis, database) instead of in-memory sessions.
-
Health Check Passes but Application Fails - Superficial health endpoints that return 200 without checking dependencies give false confidence. Ensure health checks verify database connectivity, cache access, and critical services.
-
DNS Propagation Delay - DNS-based switching has inherent propagation delays. Use load balancer or Kubernetes service selector switching for instant cutover without DNS dependency.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.