03 — Environment Strategy

Task 3: design environment strategy. The ladder a change climbs from a laptop to production, the config that differs per rung, and how artifacts are promoted, not rebuilt.


1. The environments

Env Purpose Deploys from Auto? Data
local inner-loop dev Compose (ADR-0012) throwaway
dev continuous integration of main latest main image digest auto seeded/synthetic
preview (pr-<n>) review a PR in isolation the PR’s image auto (on PR) seeded, ephemeral
staging prod-like release validation (e2e, load, soak) release-candidate digest auto on RC synthetic, prod-shaped
prod live traffic promoted digest, canary (04) gated real (never copied down)

2. Config per environment: same chart, different values

One Helm chart (05); per-environment values overlays in the GitOps repo. What legitimately differs:

Differs per env Example
Scale replicas, HPA min/max, resource requests
Dependency tier lite/standard/full (ADR-0012)
Endpoints DB host, object-storage bucket, OIDC issuer
Feature flags enable in-progress features in dev/staging first
Secrets per-env secret store / KMS key (09)
Rollout aggressiveness dev = fast rolling; prod = slow canary + analysis

What must not differ: the image (same digest), the chart templates, and the application code path. Divergence beyond values is a smell (12-factor parity).


3. Promotion: build once, promote the digest

flowchart LR
    classDef ci fill:#fde68a,stroke:#b45309,color:#111827;
    classDef e fill:#bbf7d0,stroke:#15803d,color:#111827;
    classDef g fill:#fbcfe8,stroke:#be185d,color:#111827;
    build["CI builds image once → digest D (signed, SBOM)"]:::ci
    build --> dev["dev (auto): values-dev pins D"]:::e
    dev -->|tests/e2e green| rc["staging: PR pins D as RC"]:::g
    rc -->|soak + load + manual approve| prod["prod: PR pins D → canary"]:::g
    prod --> done["stable"]:::e

4. Ephemeral preview environments


5. Data handling across environments


6. Tradeoffs / Alternatives / Scaling

Tradeoffs. More environments = more confidence but more cost/ops. We keep a tight ladder (dev/staging/prod + ephemeral previews) rather than many long-lived stages; previews give per-change isolation without permanent cost.

Alternatives considered.

Scaling concerns.

References