8 min read • Guide 806 of 877
Environment Management
Consistent environments prevent surprises. GitScrum helps track which features are deployed where and coordinate environment promotions.
Environment Strategy
Environment Types
ENVIRONMENT OVERVIEW:
┌─────────────────────────────────────────────────────────────┐
│ │
│ DEVELOPMENT (DEV): │
│ ────────────────── │
│ • Active feature development │
│ • Frequent deployments (multiple/day) │
│ • May be unstable │
│ • Developers have full access │
│ • Sample/test data │
│ │
│ STAGING: │
│ ──────── │
│ • Production-like environment │
│ • Pre-production testing │
│ • Same configuration as production │
│ • Realistic (but not real) data │
│ • Deploy before production │
│ │
│ PRODUCTION (PROD): │
│ ────────────────── │
│ • Live user traffic │
│ • Highest stability requirements │
│ • Restricted access │
│ • Real data │
│ • Monitoring and alerting │
│ │
│ ─────────────────────────────────────────────────────────── │
│ │
│ PROMOTION FLOW: │
│ │
│ DEV ──────→ STAGING ──────→ PRODUCTION │
│ │ │ │ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ Unit tests Integration Smoke tests │
│ Dev testing QA testing Monitoring │
│ Stakeholder │
│ approval │
└─────────────────────────────────────────────────────────────┘
Extended Environments
ADDITIONAL ENVIRONMENTS:
┌─────────────────────────────────────────────────────────────┐
│ │
│ OPTIONAL ENVIRONMENTS: │
│ │
│ LOCAL: │
│ Developer's machine │
│ Quick iteration │
│ May not match production exactly │
│ │
│ QA: │
│ Dedicated QA testing │
│ Stable for test execution │
│ Test data management │
│ │
│ UAT (User Acceptance Testing): │
│ Stakeholder/customer testing │
│ Business validation │
│ Before production sign-off │
│ │
│ PERFORMANCE/LOAD: │
│ Performance testing │
│ Scaled infrastructure │
│ Realistic load simulation │
│ │
│ ─────────────────────────────────────────────────────────── │
│ │
│ ENVIRONMENT MATRIX: │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ ENV PURPOSE DATA ACCESS ││
│ │ ─── ─────── ──── ────── ││
│ │ Local Development Mock/Sample Developer ││
│ │ Dev Integration Test data Team ││
│ │ QA Testing Test data QA + Team ││
│ │ UAT Acceptance Sanitized Stakeholders ││
│ │ Staging Pre-prod Realistic Limited ││
│ │ Prod Live Real Very limited ││
│ └─────────────────────────────────────────────────────────┘│
│ │
│ MORE ENVIRONMENTS = More overhead │
│ Balance: Enough for process, not too many to manage │
└─────────────────────────────────────────────────────────────┘
Environment Parity
Keeping Environments Consistent
ENVIRONMENT PARITY:
┌─────────────────────────────────────────────────────────────┐
│ │
│ THE PROBLEM: │
│ ──────────── │
│ "Works on staging, breaks in production" │
│ │
│ CAUSES: │
│ • Different OS versions │
│ • Different dependency versions │
│ • Different configuration │
│ • Different data characteristics │
│ • Different network setup │
│ │
│ ─────────────────────────────────────────────────────────── │
│ │
│ SOLUTIONS: │
│ │
│ CONTAINERIZATION: │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ Same Docker image across all environments ││
│ │ ││
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ││
│ │ │ DEV │ │ STAGING │ │ PROD │ ││
│ │ │ │ │ │ │ │ ││
│ │ │ image: │ │ image: │ │ image: │ ││
│ │ │ v1.2.3 │ │ v1.2.3 │ │ v1.2.3 │ ││
│ │ │ │ │ │ │ │ ││
│ │ └──────────┘ └──────────┘ └──────────┘ ││
│ │ ↑ ↑ ↑ ││
│ │ └──────────────┴──────────────┘ ││
│ │ Same image, same behavior ││
│ └─────────────────────────────────────────────────────────┘│
│ │
│ INFRASTRUCTURE AS CODE: │
│ • Terraform, Pulumi for infrastructure │
│ • Kubernetes manifests for deployment │
│ • Ansible for configuration │
│ • Version controlled, reviewable │
│ │
│ CONFIGURATION MANAGEMENT: │
│ • Environment variables for differences │
│ • Secrets management (Vault, AWS Secrets) │
│ • Feature flags for behavior │
└─────────────────────────────────────────────────────────────┘
Deployment Tracking
Visibility
ENVIRONMENT STATUS TRACKING:
┌─────────────────────────────────────────────────────────────┐
│ │
│ DEPLOYMENT DASHBOARD: │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ ENVIRONMENT STATUS ││
│ │ ││
│ │ ENV VERSION DEPLOYED STATUS FEATURES ││
│ │ ─── ─────── ──────── ────── ──────── ││
│ │ Dev v2.4.1 10 min ago 🟢 15 new ││
│ │ QA v2.4.0 2 hours ago 🟢 12 new ││
│ │ Staging v2.4.0 1 day ago 🟢 12 new ││
│ │ Prod v2.3.0 1 week ago 🟢 baseline ││
│ │ ││
│ │ ─────────────────────────────────────────────────────── ││
│ │ ││
│ │ PENDING PROMOTIONS: ││
│ │ • v2.4.0: Staging → Prod (scheduled: Jan 27) ││
│ │ • v2.4.1: QA → Staging (waiting QA sign-off) ││
│ │ ││
│ │ RECENT DEPLOYMENTS: ││
│ │ • v2.4.1 → Dev by @alex (10 min ago) ││
│ │ • v2.4.0 → Staging by @jordan (1 day ago) ││
│ └─────────────────────────────────────────────────────────┘│
│ │
│ WHAT'S WHERE: │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ STORY-456: New checkout flow ││
│ │ ││
│ │ Dev: ✅ Deployed (v2.4.1) ││
│ │ QA: ✅ Deployed (v2.4.0) ││
│ │ Staging: ✅ Deployed (v2.4.0) ││
│ │ Prod: ⏳ Pending (in v2.4.0, scheduled Jan 27) ││
│ └─────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────┘
Promotion Process
Environment Gates
PROMOTION WORKFLOW:
┌─────────────────────────────────────────────────────────────┐
│ │
│ DEV → QA PROMOTION: │
│ ─────────────────── │
│ ☐ All unit tests passing │
│ ☐ Code review approved │
│ ☐ Build successful │
│ ☐ Feature complete for testing │
│ │
│ QA → STAGING PROMOTION: │
│ ─────────────────────── │
│ ☐ QA testing complete │
│ ☐ No critical bugs │
│ ☐ Regression tests passing │
│ ☐ QA sign-off │
│ │
│ STAGING → PRODUCTION: │
│ ───────────────────── │
│ ☐ Staging verification complete │
│ ☐ Stakeholder approval (if needed) │
│ ☐ Release notes prepared │
│ ☐ Rollback plan ready │
│ ☐ Deployment window confirmed │
│ ☐ On-call team notified │
│ │
│ ─────────────────────────────────────────────────────────── │
│ │
│ PROMOTION TASK: │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ RELEASE-024: Promote v2.4.0 to Production ││
│ │ ││
│ │ VERSION: v2.4.0 ││
│ │ CURRENT: Staging ││
│ │ TARGET: Production ││
│ │ SCHEDULED: Jan 27, 2pm UTC ││
│ │ ││
│ │ CHECKLIST: ││
│ │ ☑ Staging tests passed ││
│ │ ☑ Release notes published ││
│ │ ☑ Rollback plan documented ││
│ │ ☐ Deploy to production ││
│ │ ☐ Smoke tests ││
│ │ ☐ Monitor for 1 hour ││
│ │ ☐ Mark release complete ││
│ │ ││
│ │ OWNER: @jordan ││
│ │ APPROVERS: @tech-lead, @product-owner ││
│ └─────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────┘
Environment Troubleshooting
Common Issues
ENVIRONMENT PROBLEMS:
┌─────────────────────────────────────────────────────────────┐
│ │
│ PROBLEM: "Works locally, fails in dev" │
│ ───────────────────────────────────── │
│ CAUSES: │
│ • Missing environment variables │
│ • Different dependency versions │
│ • Local-only services not available │
│ │
│ FIX: │
│ • Use Docker for local development │
│ • Document all environment variables │
│ • Lock dependency versions │
│ │
│ ─────────────────────────────────────────────────────────── │
│ │
│ PROBLEM: "Staging passed, production failed" │
│ ──────────────────────────────────────────── │
│ CAUSES: │
│ • Data volume differences │
│ • Third-party service behavior │
│ • Configuration drift │
│ │
│ FIX: │
│ • Mirror production traffic to staging │
│ • Infrastructure as code (no manual changes) │
│ • Regular environment audits │
│ │
│ ─────────────────────────────────────────────────────────── │
│ │
│ PROBLEM: "Environment is slow/broken" │
│ ───────────────────────────────────── │
│ CAUSES: │
│ • Resource exhaustion │
│ • Bad deployment │
│ • Data corruption │
│ │
│ FIX: │
│ • Monitoring and alerting │
│ • Environment refresh procedures │
│ • Quick restore from known-good state │
└─────────────────────────────────────────────────────────────┘