Skip to content

fix: mount the scaffolded database volume where PostgreSQL 18 stores data - #165

Merged
Bccorb merged 1 commit into
mainfrom
fix/postgres-18-volume-mount
Aug 2, 2026
Merged

fix: mount the scaffolded database volume where PostgreSQL 18 stores data#165
Bccorb merged 1 commit into
mainfrom
fix/postgres-18-volume-mount

Conversation

@Bccorb

@Bccorb Bccorb commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Fixes a defect introduced by #164, caught while doing the same bump in seamless-templates (fells-code/seamless-templates#42).

The bug

#164 moved the image tag but not the volume mount. PostgreSQL 18+ images store data in a major-versioned subdirectory (/var/lib/postgresql/18/docker), so a mount at /var/lib/postgresql/data is ignored and the container refuses to start:

Error: in 18+, these Docker images are configured to store database data in a
       format which is compatible with "pg_ctlcluster" ...
       Counter to that, there appears to be PostgreSQL data in:
         /var/lib/postgresql/data (unused mount/volume)

It restart-loops. A project scaffolded from that change had a database that never came up. See docker-library/postgres#1259.

Why CI missed it, and why that matters

The verify / verify job passed on #164 and I reported it as end-to-end proof. It wasn't. The harness's postgres service mounts no volume at all, so it used the new in-image default and worked fine. The broken artifact was the generated compose file, which nothing in CI ever stands up.

That is the real gap: verify exercises the running stack, not what init writes to disk. This PR closes the specific hole with a unit test asserting the generated mount path, but the general shape — a generated artifact no test executes — is worth a follow-up.

Verified

Scaffolded a project with the built CLI and brought its database up:

  • running (healthy), PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1)
  • PGDATA=/var/lib/postgresql/18/docker, resolving inside the mounted volume
  • wrote a row, docker compose up -d --force-recreate db, read it back: survives, so the volume is genuinely in use rather than data silently living in the container layer

Also reproduced the failure first with the old mount, so the test is against a real defect rather than a theory. npm test passes (816 passed, 4 skipped).

Release impact

None shipped. 0.11.0 is on npm; the PostgreSQL 18 change is still sitting unreleased in the release PR (#163). This lands ahead of it, so no published version ever produced a broken scaffold.

Related

The same mount change is needed everywhere else postgres moves to 18. The five issues I filed for the org rollout all say "bump the tag" and none mention the mount; I'm updating them now.

…data

The PostgreSQL 18 bump moved the image tag but not the volume mount. PostgreSQL
18+ images store data in a major-versioned subdirectory
(/var/lib/postgresql/18/docker), so a mount at /var/lib/postgresql/data is
ignored and the container refuses to start, restart-looping on "in 18+, these
Docker images are configured to store database data in a format which is
compatible with pg_ctlcluster". The generated compose now mounts
pgdata:/var/lib/postgresql.

The conformance harness did not catch this because its postgres service mounts
no volume at all, so it used the new in-image default and passed. The gap was a
generated artifact nothing stood up. Covered now by a unit test on the generated
compose, and verified by scaffolding a project and bringing its database up: it
reports PostgreSQL 18.4 with PGDATA inside the mount, and a row written before a
--force-recreate survives it.

Only projects scaffolded from the unreleased 18 change were affected.
@Bccorb

Bccorb commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Filed #166 for the underlying gap this exposed: nothing in CI executes what init generates, so the broken scaffold passed both jobs and review. It also records a related finding, that seamless check exits 0 even when every service is unreachable, which is why it cannot be dropped in as the CI assertion without a change.

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