Document local database production deployment

This commit is contained in:
Codex
2026-04-28 09:04:03 +08:00
parent 8697aa3fbb
commit 21cb5c9c15
5 changed files with 252 additions and 12 deletions
+19 -10
View File
@@ -2,6 +2,8 @@
This runbook is the source of truth for taking the Eversolo Payload/Next.js site from a local database and media folder to a production deployment.
For the command-level Chinese handoff guide, see `docs/local-db-to-production-deployment.md`.
## Release Inputs
- Git commit to deploy.
@@ -28,16 +30,23 @@ Optional variables:
## Deployment Steps
1. Restore the approved PostgreSQL dump into the production database.
2. Copy `media/` and `files/` to the production persistent upload volume.
3. Install dependencies with `npm ci`.
4. Run `npm run generate:types` only during build validation, not as a production data mutation step.
5. Run `npm run typecheck`.
6. Run `npm run build`.
7. Run `npm run payload:migrate`.
8. Run `npm run payload:migrate:status` and confirm every migration is `Yes`.
9. Start the app with `npm run start`.
10. Run `npm run smoke -- "$NEXT_PUBLIC_SITE_URL"`.
1. Run local release checks: `npm run lint`, `npm run typecheck`, `npm run build`, and `npm run payload:migrate:status`.
2. Load the local release environment with `set -a; source .env; set +a`, then confirm the local release database has no dev marker:
`psql "$DATABASE_URI" -Atc "select count(*) from payload_migrations where batch = -1;"`.
3. Export the approved PostgreSQL database:
`pg_dump --format=custom --no-owner --no-acl --file=eversolo.payload.dump "$DATABASE_URI"`.
4. Export matching uploads:
`tar -czf eversolo.uploads.tgz media files`.
5. Restore the approved PostgreSQL dump into the production database with `pg_restore --no-owner --no-acl`.
6. Copy `media/` and `files/` to the production persistent upload volume.
7. Install dependencies with `npm ci`.
8. Run `npm run generate:types` only during build validation, not as a production data mutation step.
9. Run `npm run typecheck`.
10. Run `npm run build`.
11. Run `npm run payload:migrate`.
12. Run `npm run payload:migrate:status` and confirm every migration is `Yes`.
13. Start the app with `npm run start`.
14. Run `npm run smoke -- "$NEXT_PUBLIC_SITE_URL"`.
## Data Rules