Metadata Card
- Prerequisites: Chapter 14 (Microservices Patterns)
- Estimated Time: 40 minutes
- Core Difficulty: Intermediate
- Completion Milestone: Understand common deployment strategies and release patterns
Your Progress
Engines are running, data is consistent. But every release requires 30 seconds of pipeline downtime — users see "System under maintenance." One time you misconfigured a pipe parameter, bringing down the entire production line.
You're afraid to upgrade, but the workshop master wants 20 iterations a day.
You need a technique to swap parts without stopping the machine. Your Task
Blue/Green, Canary, Feature Flags, Sidecar, Ambassador — patterns for zero-downtime deployment.
Required reading: Blue/Green, Canary, Feature Flags Selective: Sidecar, Ambassador Advanced: Chaos Engineering basics
First Layer: Blue/Green Deployment
Two identical environments. Blue runs current version (production). Green runs new version. Switch traffic instantly.
# Switch to green
sed -i 's/server green.*/server green:8080 weight=1;/' nginx.conf
nginx -s reload
# Rollback: one commandSecond Layer: Canary Release
Gradually shift traffic. Start with 1%, observe, then 5%, 20%, 100%. Requires monitoring comparison between canary and baseline.
Third Layer: Feature Flags
Control feature enablement through code conditions, not deployments. Allows progressive rollouts, A/B testing, instant rollback.
if (featureFlags.isEnabled("new-scoring-algorithm")) {
return newAlgorithm(match);
}
return oldAlgorithm(match);Fourth Layer: Sidecar & Ambassador
Sidecar: a helper container running alongside the main container (log collector, monitoring agent). Ambassador: a network proxy sidecar handling retry, timeout, circuit breaking.
Common Pitfalls: Blue/Green double infrastructure cost, canary without automated success/failure criteria, feature flag accumulation, no instant rollback capability.
Traveler's Notes
Deployment patterns control the riskiest operation — code changes. Blue/Green enables instant switching, Canary provides brakes while moving, Feature Flags decouple deployment from enablement, Sidecar/Ambassador put infrastructure capability beside your service.
Next: Event-Driven Architecture (Chapter 17).