fix(docker): move Postgres to a named volume and bump to Postgres 18 (beta)#487
Merged
Merged
Conversation
Ports the fix from #486 (main) to beta: docker compose build fails at "load build context" because Postgres locks ./docker-data/postgres down to 0700 once it's run, and BuildKit's context walker aborts on any permission-denied entry under the build context root regardless of .dockerignore rules. Switch Postgres to the named volume testplanit-postgres-data across both compose files tracked on this branch, so its data can never live inside the build context again. Also fixes the .dockerignore inconsistency across the three ignore files (hygiene; verified insufficient alone for this bug). Also bumps Postgres 15 -> 18 (three majors behind current stable), pinning PGDATA back to the old flat path since the 18+ image defaults to a version-specific subdirectory and expects the volume mounted at /var/lib/postgresql instead of .../data (docker-library/postgres#1259), and the new layout has a still-open detection bug (docker-library/postgres#1400) that reproduced reliably in testing. Verified on this branch's actual files: postgres:18-alpine starts healthy, and data survives a full down/up cycle. Note: docker-compose.prod.yml is not tracked on this branch (removed in db5cfd8 for containing server-specific IPs) and is not touched here; whoever maintains that file's local/server copy needs the equivalent change (named volume + PGDATA pin) applied manually.
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.
Description
Ports the fix from #486 (targeting
main) tobeta. Fixes #485:docker compose build prodfails at the[internal] load build contextstep with a permission error ondocker-data/postgres.Root cause: the compose files bind-mount
./docker-data/postgresdirectly onto/var/lib/postgresql/data. Once Postgres has run, it locks that directory down to0700. The app builds usecontext: ..(the repo root), so that directory sits inside the build context. BuildKit's context sender needs to stat/read every entry under the context root — a permission-denied directory there aborts the whole context transfer, regardless of.dockerignorerules, since the walk fails before exclusion patterns are applied. Verified empirically on #486 (see that PR for the full repro/verification writeup); this PR applies the same verified fix to the files tracked onbeta.Changes
testplanit-postgres-data) instead of a bind mount, in both compose files tracked on this branch (docker-compose.yml,docker-compose.dev.yml)..dockerignoreinconsistency across all three ignore files (hygiene; verified insufficient alone for this bug in fix(docker): move Postgres to a named volume and bump to Postgres 18 #486).PGDATA=/var/lib/postgresql/datasince the 18+ image defaults to a version-specific subdirectory and expects the volume mounted at/var/lib/postgresqlinstead of.../data(docker-library/postgres#1259) — reproduced locally — and the new layout has a still-open detection bug (docker-library/postgres#1400) that also reproduced reliably in testing.docker-setup.md,deployment.md) with the new data-persistence layout, backup/restore commands, and a migration note for existing deployments (Postgres 18 can't read a Postgres 15 data directory, so this needs a realpg_dump/pg_restore, not a raw file copy).Note on
docker-compose.prod.ymlThat file isn't tracked on
beta— it was removed indb5cfd83a("remove prod compose from tracking; add to gitignore") because it contains server-specific IPs, and isn't touched by this PR. Whoever maintains that file's local/server copy needs the equivalent change (named volume +PGDATApin + Postgres 18 tag) applied manually.Related Issue
Relates to #485 (fixed on
mainvia #486; this ports the same fix tobeta)Type of Change
Breaking in the sense that existing deployments must run the documented
pg_dump/pg_restoremigration before their nextdocker compose build/up.How Has This Been Tested?
Same verification approach as #486, re-run against this branch's actual files:
postgresfromdocker-compose.yml(dev profile) with the named-volume override — reports healthy,SELECT version()confirms PostgreSQL 18.4.down/upcycle — a marker row written before the restart survives after, confirming the named volume persists data correctly across container recreation.docker compose configresolves cleanly for both tracked compose files.mainin fix(docker): move Postgres to a named volume and bump to Postgres 18 #486 (this worktree had no localnode_modulesto re-run Prettier against, but the patch applied viagit apply --checkwith zero fuzz, confirming byte-identical content).Checklist
Additional Notes
None of this touches application source, tests, or types.