|
| 1 | +# Deployment Maturity Ladder |
| 2 | + |
| 3 | +This guide defines a practical path for deploying applications with Codewise CLI. |
| 4 | + |
| 5 | +The goal is to move safely through 3 stages: |
| 6 | +- Local (developer machine) |
| 7 | +- Staging (shared non-production cluster) |
| 8 | +- Production (high-confidence rollout) |
| 9 | + |
| 10 | +## Stage 1: Local Deployment Ready |
| 11 | + |
| 12 | +Use this stage to prove command flow and basic behavior. |
| 13 | + |
| 14 | +### Exit Criteria |
| 15 | +- The project builds successfully. |
| 16 | +- Automated tests pass. |
| 17 | +- Kubernetes and Helm scaffolds generate correctly. |
| 18 | +- Dry-run commands work without errors. |
| 19 | +- At least one environment profile exists and loads correctly. |
| 20 | + |
| 21 | +### Suggested Checks |
| 22 | +Run from project root: |
| 23 | + |
| 24 | +1. make build |
| 25 | +2. go test ./... -v |
| 26 | +3. ./codewise-cli helm init |
| 27 | +4. ./codewise-cli k8s init |
| 28 | +5. ./codewise-cli k8s apply --dry-run |
| 29 | +6. ./codewise-cli deploy plan --env dev |
| 30 | + |
| 31 | +### Notes |
| 32 | +- This stage should not mutate any production resources. |
| 33 | +- Keep context pointed to local clusters only (kind, minikube, k3d, etc.). |
| 34 | + |
| 35 | +## Stage 2: Staging Deployment Ready |
| 36 | + |
| 37 | +Use this stage to validate behavior in a real shared cluster. |
| 38 | + |
| 39 | +### Exit Criteria |
| 40 | +- Environment-specific deployment works end-to-end. |
| 41 | +- Rollout monitoring succeeds for all target deployments. |
| 42 | +- Status, logs, and history commands are usable for troubleshooting. |
| 43 | +- Rollback path is tested at least once on staging. |
| 44 | +- Team can reproduce deployment steps from docs without tribal knowledge. |
| 45 | + |
| 46 | +### Suggested Checks |
| 47 | +1. ./codewise-cli env create staging |
| 48 | +2. ./codewise-cli deploy plan --env staging |
| 49 | +3. ./codewise-cli deploy run --env staging |
| 50 | +4. ./codewise-cli deploy status --env staging |
| 51 | +5. ./codewise-cli deploy logs --env staging --follow |
| 52 | +6. ./codewise-cli deploy history --env staging |
| 53 | +7. ./codewise-cli deploy rollback --env staging --revision <known-good-revision> |
| 54 | + |
| 55 | +### Notes |
| 56 | +- Use a dedicated staging namespace and cluster context. |
| 57 | +- Test rollback before any production attempt. |
| 58 | + |
| 59 | +## Stage 3: Production Deployment Ready |
| 60 | + |
| 61 | +Use this stage only when reliability and observability are strong. |
| 62 | + |
| 63 | +### Exit Criteria |
| 64 | +- Deploy package has automated tests for deploy logic (strategy resolution, command building, error paths). |
| 65 | +- Preflight checks fail fast with actionable error messages. |
| 66 | +- CI blocks merges on test failures. |
| 67 | +- Rollback runbook is documented and time-to-recovery is known. |
| 68 | +- A production promotion checklist exists and is followed. |
| 69 | + |
| 70 | +### Minimum Promotion Checklist |
| 71 | +1. Confirm current kube context and namespace are correct. |
| 72 | +2. Run deployment plan for target environment. |
| 73 | +3. Verify image tag and chart/manifest inputs. |
| 74 | +4. Deploy with a human-in-the-loop approval. |
| 75 | +5. Confirm rollout and health signals. |
| 76 | +6. Confirm logs and status after rollout. |
| 77 | +7. Keep rollback command prepared with known-good revision. |
| 78 | + |
| 79 | +## Should We Deploy Now? |
| 80 | + |
| 81 | +- Yes for Local and Staging progression. |
| 82 | +- No for full Production usage until deployment test coverage and runbook consistency are improved. |
| 83 | + |
| 84 | +## What To Do Next In This Repo |
| 85 | + |
| 86 | +1. Add deployment-focused automated tests under tests/deploy. |
| 87 | +2. Standardize docs and examples to use env-based deploy flags consistently. |
| 88 | +3. Improve deploy command output where subprocess stderr/stdout is currently suppressed. |
| 89 | +4. Add a release workflow for shipping the CLI binary (separate from app deployment). |
| 90 | + |
| 91 | +This sequence gives fast progress without taking unnecessary production risk. |
0 commit comments