fix(compose): mount db volume at /var/lib/postgresql for postgres 18#32
Merged
Merged
Conversation
The postgres 18 docker images changed their expected volume layout — they now require a single mount at /var/lib/postgresql (data goes in a version-specific subdirectory the entrypoint manages itself) instead of a mount directly at .../data. See docker-library/postgres#1259. Mounting at .../data (the pre-18 convention, still in docker-compose.yml after the postgres 16->18 bump) makes the postgres 18 entrypoint refuse to start outright — reproduced locally, both against a fresh volume and an existing one: Error: in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster"... As merged, main cannot boot `db` at all right now. Verified the fix: full stack (db + api + ui via nginx) comes up healthy, 28 pending migrations apply cleanly, seed runs, api serves through the proxy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
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
As merged (postgres 16-alpine → 18-alpine, #29),
docker-compose.ymlcannot startdbat all — reproduced locally on both a fresh volume and one with existing data:Postgres 18's images changed the expected volume convention: a single mount at
/var/lib/postgresql, with data placed in a version-specific subdirectory the entrypoint manages itself, instead of a mount directly at.../data(docker-library/postgres#1259).api/uinever got a chance to start either, since they depend ondbbeing healthy.Change
Mount at
/var/lib/postgresqlinstead of/var/lib/postgresql/data.This makes 18 boot, nothing more. If anyone has real data sitting in
./volumes/db-data/from a prior 16.x deployment, it's laid out directly in that directory (PG_VERSION,base/, etc.) — with this mount-path change, postgres 18 will look for data in a subdirectory of the same mount, not find the old files, and silently initialize a fresh empty database next to the orphaned 16 data. Nothing gets deleted, but it'll look like data loss. A real upgrade needspg_upgrade(or dump/restore) run explicitly before/during this transition — this PR doesn't attempt that, it only fixes the mount so 18 can start at all (matches the state before #29, where nobody could get pastdbfailing to start anyway).Test plan
dbreports healthy, 28 pending migrations apply cleanly, seed runs,apibootscurl http://localhost/api/version→200 {"version":"0.7.0"}🤖 Generated with Claude Code