Designing Deployment Strategies

1. Designing Blue-Green Deployment

AspectDetail
Two envsBlue (live) + Green (idle)
SwitchoverLB / DNS / router
RollbackSwitch back instantly
Cost2× infra during deploy
DB challengeSchema must support both versions

2. Designing Canary Deployment

AspectDetail
Stage1% → 5% → 25% → 100%
RoutingService mesh / Argo Rollouts / Flagger
Auto-analysisCompare canary vs baseline metrics
Auto-rollbackOn regression
Best forHigh-traffic services

3. Designing Rolling Deployment

ParameterDetail
maxSurgeExtra pods during update
maxUnavailableHow many can be down
Pod-by-podK8s default
ProsNo extra cost
ConsBoth versions live; slower rollback

4. Designing Shadow Deployment

ElementDetail
Mirror trafficSend copy to new version
No user impactDiscard responses
Use caseValidate perf / behavior on real traffic
CaveatSide effects must be guarded

5. Designing Database Migration Strategy

PhaseDetail
ExpandAdd new column/table; nullable
BackfillPopulate via job
MigrateApp reads new + writes both
ContractDrop old after stable
ToolsFlyway, Liquibase, Atlas, gh-ost, pt-osc

6. Designing Zero-Downtime Deployment

RequirementDetail
Backwards-compat APIsN supports N+1 contracts
Graceful shutdownSIGTERM + drain
Connection drainingLB stops new traffic
Idempotent jobsSafe to interrupt

7. Designing Rollback Mechanisms

TypeDetail
Image rollbackRe-deploy previous tag
Helm rollbackhelm rollback <rev>
Argo Rollout abortPromote previous
DB schema rollbackAvoid via expand-contract
Forward-fixSometimes faster than rollback

8. Designing A/B Deployment Infrastructure

ElementDetail
Two versions liveIndependent deployments
Traffic splitHeader / cookie / % based
Sticky bucketingUser stays on variant
Metrics taggedPer variant for analysis

9. Designing Environment Configuration Management

PracticeDetail
Env parityStage matches prod closely
PromotionSame artifact dev → stage → prod
Per-env secretsSeparate vaults / paths
IaCProvision via Terraform / Pulumi

10. Designing Deployment Pipeline

StageDetail
BuildCompile, test, scan
PackageContainer image; sign (cosign)
Deploy stageSmoke + integration tests
Deploy prodCanary with auto-analysis
ToolsGitHub Actions, GitLab CI, ArgoCD, Spinnaker

11. Designing Progressive Rollout

MechanismDetail
Ring deploymentInternal → beta → GA rings
Geo rolloutOne region at a time
Tenant rolloutCohort-based
Feature flag wrapDecouple deploy from release

12. Designing Deployment Verification

CheckDetail
Smoke testsCritical paths post-deploy
Synthetic monitorsContinuous probes
SLO burn rateAuto-rollback trigger
Error rate / latencyvs baseline
Feature flag checkVerify intended state