Make production Postgres durable and migrated#22
Merged
Conversation
Run Prisma migrations as part of the EC2 Docker Compose rollout and bind Postgres data to the EBS mount path so upload data has tables and persists outside the container lifecycle.\n\nConstraint: Production DB was online but empty; psql \dt returned no relations, and the requested storage target is EBS-backed Postgres data.\nRejected: Manual database patching only | future deploys would recreate the same missing-schema failure.\nConfidence: high\nScope-risk: moderate\nDirective: Keep Postgres data on /mnt/tomotono-postgres/data for EC2 unless an explicit POSTGRES_DATA_DIR override is supplied.\nTested: bash -n scripts/ec2-bootstrap-and-deploy.sh; docker compose config --quiet; npx prisma validate; docker build --target migrator -t tomotono-route-console-migrator:local-test .; docker compose migrator applied 20260430070000_init to a disposable Postgres and produced 9 tables; npm test; npm run lint; npm run build\nNot-tested: Live EC2 redeploy after this commit pending main merge.\n\nCo-authored-by: OmX <omx@oh-my-codex.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
migratortarget/service and run it before app rollout in the EC2 deploy scriptPOSTGRES_DATA_DIR, defaulting EC2 deploys to/mnt/tomotono-postgres/dataRoot cause
Production Postgres was running, but the database had no app tables. SSM confirmed
psql \dtreturnedDid not find any relations., so CSV upload had nowhere to persist route/import records.EBS
Created and mounted a dedicated encrypted gp3 EBS volume for Postgres data:
vol-0d7847d66a798e0e5/mnt/tomotono-postgres/mnt/tomotono-postgres/dataVerification
bash -n scripts/ec2-bootstrap-and-deploy.shdocker compose config --quietnpx prisma validatedocker build --target migrator -t tomotono-route-console-migrator:local-test .docker compose run --rm migrateapplied20260430070000_initand created 9 tablesnpm testnpm run lintnpm run buildRefs #21