Deployment
How to deploy, run migrations, and roll back. The full mechanics (CI/CD, image tags, manifests, GitOps) are in Infrastructure → Operations - this page is the quick recipe.
Environments
| Env | How it deploys | Notes |
|---|---|---|
| local | make dev-<svc> / make dev-app-<name> | hot reload |
| develop | Docker Compose | per-service compose under infrastructure/deployments/ |
| staging | manual kubectl apply of the manifests | VNPAY cloud K8s |
| production | GitOps auto-deploy | merge → pipeline → cluster |
See the full per-environment sequence in Infrastructure → Operations → Deployment Sequence.
Deploy (quick)
- Build & push the image (CI does this on merge) - tag strategy in infra.
- Roll out:
kubectl set image deploy/<svc> <svc>=<image>:<tag> -n nx-backend(staging) or merge for prod GitOps. - Watch:
kubectl rollout status deploy/<svc> -n nx-backend.
Database migrations
Migrations run as Jobs before the new version serves traffic - never hand-run against prod. Template + order in infra → Migration Jobs. Dev: bun run migrate:dev per package.
Rollback
kubectl rollout undo deploy/<svc> -n nx-backend(back to the previous ReplicaSet), or re-deploy the last good tag.- If a migration is involved, a rollback may need a compensating migration - do not blindly revert schema.
- Confirm health, then write the post-mortem.
Full rollback detail: Infrastructure → Operations → Rollback.
Secrets
Secrets are SealedSecrets decrypted into K8s Secrets - see Infrastructure → Configuration. Never put real secret values in the repo or this wiki.