Skip to content

fix(compose): mount db volume at /var/lib/postgresql for postgres 18#32

Merged
obrien-k merged 1 commit into
orphic-inc:mainfrom
obrien-k:fix/postgres18-mount-path
Jul 19, 2026
Merged

fix(compose): mount db volume at /var/lib/postgresql for postgres 18#32
obrien-k merged 1 commit into
orphic-inc:mainfrom
obrien-k:fix/postgres18-mount-path

Conversation

@obrien-k

@obrien-k obrien-k commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

As merged (postgres 16-alpine → 18-alpine, #29), docker-compose.yml cannot start db at all — reproduced locally on both a fresh volume and one with existing data:

Error: in 18+, these Docker images are configured to store database data in a
       format which is compatible with "pg_ctlcluster" (specifically, using
       major-version-specific directory names)...

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/ui never got a chance to start either, since they depend on db being healthy.

Change

Mount at /var/lib/postgresql instead of /var/lib/postgresql/data.

⚠️ Not an upgrade path

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 needs pg_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 past db failing to start anyway).

Test plan

  • Fresh volume: db reports healthy, 28 pending migrations apply cleanly, seed runs, api boots
  • Confirmed end-to-end through nginx: curl http://localhost/api/version200 {"version":"0.7.0"}
  • Verify no one has an existing populated 16.x volume depending on this repo's compose file before merging (see caveat above)

🤖 Generated with Claude Code

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>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@obrien-k
obrien-k merged commit 51c6f6e into orphic-inc:main Jul 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant