Runbook — Deploy dashboard-api
Steps to deploy the dashboard-api service to the staging / production environment.
Prerequisites
- Access to the target server (SSH key at
~/.ssh/kesles-prod) KESLES_SECRET_ENCRYPTION_KEYregistered in the server env- Target PostgreSQL has been migrated to the latest version (see db-schema)
Deploy Steps
1. Build binary locally
cd services/dashboard_api
go build -o dashboard-api ./cmd/server
2. Local smoke test
./dashboard-api --config config-staging.yaml &
curl -fsS http://localhost:8082/health
kill %1
3. Push to server
scp dashboard-api kesles-prod:/opt/kesles/dashboard-api/bin/
ssh kesles-prod "systemctl restart dashboard-api"
4. Verify post-deploy
curl -fsS https://api-merchant-staging.kesles.com/health
# expect 200 {"status":"ok","build":"<git-sha>"}
5. Monitor for 10 minutes
- Tail log:
ssh kesles-prod "journalctl -u dashboard-api -f" - Watch metrics dashboard:
https://grafana.kesles.internal/d/dashboard-api
Rollback
If the health check fails or error rate rises > 1%:
ssh kesles-prod "cp /opt/kesles/dashboard-api/bin/dashboard-api.prev /opt/kesles/dashboard-api/bin/dashboard-api && systemctl restart dashboard-api"
The previous binary version is always backed up to .prev on each deploy.
Production Deploy Checklist
- Staging has been running ≥ 24 hours without an error spike
- Production DB migration has been executed via
scripts/apply_migration.sh(tracker-aware sejak mig 140) — verify no drift:diffls migrations/vsSELECT name FROM public.schema_migrations. Reference:merchant_docs/docs/database/operations/migration-workflow.md. - PR merged to
mainwith reviewer approval - Pre-prod smoke test passes
- Oncall standby notified via Slack
#oncall-engineering - Deploy window: Monday–Thursday, 10:00–16:00 WIB (avoid weekends/end of month)
Related
- Secret Rotation — if deploy coincides with HMAC rotation
- Incident Response — if the deploy breaks production