Deploy
CI/CD: .github/workflows/deploy.yml runs on push to main: test → migrate staging → deploy
staging → manual approval → migrate prod → deploy prod.
Prerequisites (one-time)
Section titled “Prerequisites (one-time)”- Repo secrets:
RAILWAY_TOKEN,STAGING_DATABASE_URL,PROD_DATABASE_URL. - GitHub
productionenvironment protected with required reviewers (the approval gate).
Normal deploy
Section titled “Normal deploy”- Merge to
main. CI runs (lint + tests + web/marketing build). - Migrations apply to staging, then services deploy to staging.
- Smoke-check staging:
GET /healthok; log in; open a device; pull a report. - Approve the
productionenvironment in the workflow run. - Migrations apply to prod, then services deploy.
- Verify prod
GET /health+ a real user flow.
Migrations
Section titled “Migrations”- Forward-compatible: deploy code that tolerates both old and new schema, or migrate before deploy (the pipeline migrates first). Avoid destructive migrations in the same release as the code that still reads the old shape.
- Migrations are Alembic (
backend/app/db/migrations);alembic upgrade head.
If a deploy goes wrong
Section titled “If a deploy goes wrong”→ rollback.md.