Deployment Strategies
Big Bang Deployment
Deploy all changes at once to all servers.
v1.0 → v2.0 (all users, instantly)
Pros: Simple Cons: High risk, difficult rollback, full impact on users
Rolling Deployment
Gradually replace instances with new version.
Instance 1: v1.0 → v2.0 (users switch)
Wait for health checks...
Instance 2: v1.0 → v2.0
Instance 3: v1.0 → v2.0
Pros: Zero downtime, gradual rollout Cons: Complex orchestration, two versions running temporarily
Blue-Green Deployment
Maintain two identical environments.
Blue (v1.0) ← Current traffic
Green (v2.0) ← Testing
Verify v2.0 works → Switch traffic to Green
Pros: Zero downtime, instant rollback Cons: Double infrastructure cost
Canary Deployment
Route small percentage of traffic to new version.
v2.0 → 5% of users (Monday)
→ 25% of users (Tuesday)
→ 50% of users (Wednesday)
→ 100% of users (Thursday)
Pros: Low risk, quick rollback, real-world testing Cons: Complex monitoring, gradual rollout time
Feature Flags
Toggle features without deployment.
if (featureFlags.newCheckout === true) {
// new checkout flow
} else {
// old checkout flow
}
Pros: Immediate rollback, independent feature control Cons: Code complexity, flag management overhead
Database Migrations
Careful approach to schema changes:
- Deploy backward-compatible database changes
- Deploy application changes
- Cleanup old database structures
Rollback Strategies
Database
- Maintain rollback scripts
- Backup before migrations
- Test rollback procedures
Application
- Previous version still available
- Traffic routed back quickly
- Verify rollback completeness
Choosing a Strategy
- Small changes: Rolling deployment
- Complex changes: Blue-green deployment
- Risk-averse: Canary deployment
- Quick iterations: Feature flags
Best Practices
- Automate deployments
- Monitor before, during, and after
- Have runbooks for rollbacks
- Test deployment procedures
- Communicate with stakeholders
- Practice deployment procedures
