Skip to content

Pin PGDATA so postgres:18 works with legacy volume mount#777

Merged
rdimitrov merged 2 commits into
mainfrom
fix/postgres-18-pgdata
May 7, 2026
Merged

Pin PGDATA so postgres:18 works with legacy volume mount#777
rdimitrov merged 2 commits into
mainfrom
fix/postgres-18-pgdata

Conversation

@rdimitrov
Copy link
Copy Markdown
Member

Summary

  • postgres:18 changed its default PGDATA to /var/lib/postgresql/$PG_MAJOR/docker (Change PGDATA in 18+ to /var/lib/postgresql/MAJOR/docker docker-library/postgres#1259). The entrypoint now refuses to start when it sees a mount at the legacy /var/lib/postgresql/data path — even on a fresh volume — exiting with unused mount/volume.
  • Set PGDATA=/var/lib/postgresql/data explicitly on the postgres service in both docker-compose.yaml and docker-compose.smoke-test.yaml so the existing volume layout keeps working.

Why this minimal override

Upstream's recommended config for 18+ is to mount at /var/lib/postgresql (parent dir) so pg_upgrade --link works without crossing mount boundaries. That's a bigger change to the volume layout and would lose existing data on upgrade. Pinning PGDATA is the smallest diff that unbreaks docker compose up today; the parent-mount migration can be a follow-up if/when major-version upgrades are on the table.

Test plan

  • docker compose down -v && docker compose up from a clean state — postgres reaches healthy, registry-api runs migrations and serves on :8080.
  • docker compose -f docker-compose.smoke-test.yaml --project-name thv-smoke-test up --detach --wait succeeds (or run the smoke-test skill end-to-end).

Fixes #773

🤖 Generated with Claude Code

`postgres:18` changed its default `PGDATA` from `/var/lib/postgresql/data`
to `/var/lib/postgresql/$PG_MAJOR/docker` (docker-library/postgres#1259).
The entrypoint now probes for a mount at the legacy path and exits with
`unused mount/volume` even on a fresh volume, which breaks `docker compose
up` for new developer machines and CI runs that include this compose
file.

Set `PGDATA=/var/lib/postgresql/data` explicitly on the postgres service
in both `docker-compose.yaml` and `docker-compose.smoke-test.yaml`. This
overrides the new default so the existing volume layout keeps working
without rewriting the mount path.

Fixes #773
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.07%. Comparing base (8649e14) to head (e03b48d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #777   +/-   ##
=======================================
  Coverage   61.07%   61.07%           
=======================================
  Files         108      108           
  Lines       10593    10593           
=======================================
  Hits         6470     6470           
  Misses       3546     3546           
  Partials      577      577           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rdimitrov rdimitrov enabled auto-merge (squash) May 7, 2026 19:05
@rdimitrov rdimitrov merged commit 13800cd into main May 7, 2026
14 checks passed
@rdimitrov rdimitrov deleted the fix/postgres-18-pgdata branch May 7, 2026 20:08
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.

fix: set PGDATA explicitly in docker-compose.yaml for postgres:18 compatibility

3 participants