You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(docker): move Postgres to a named volume and bump to Postgres 18 (#486)
* fix(docker): store Postgres cluster in a pgdata subdirectory
The prod compose bind-mounted ./docker-data/postgres straight onto
/var/lib/postgresql/data. The mount-point root is owned by the host, so
Postgres could refuse to (re)initialize on repeated `docker compose up`
runs. Point PGDATA at a pgdata/ subdirectory the Postgres entrypoint
creates and owns itself, sidestepping the mount-point ownership.
Existing deployments must move their cluster into docker-data/postgres/pgdata
once before upgrading; documented in the Docker setup guide.
* fix(docker): rework Postgres ownership fix as a chown-init sidecar
Replace the PGDATA-subdirectory approach with a postgres-init service,
mirroring the existing elasticsearch-init pattern: it chowns the
bind-mounted ./docker-data/postgres path to postgres:postgres before
the postgres service starts. This corrects ownership in place on every
`docker compose up`, so existing deployments need no data migration
(the PGDATA subdirectory approach required moving the cluster on disk).
* fix(docker): apply the postgres-init chown sidecar to dev compose files
docker-compose.yml and docker-compose.dev.yml bind-mount ./docker-data/postgres
the same way the prod compose does, so they carry the same ownership bug.
Add the same postgres-init sidecar to both, gating postgres on it.
* fix(docker): move Postgres to a named volume, replacing the postgres-init sidecar
The postgres-init chown sidecar didn't address the actual reported bug
(#485): 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 needs to stat every entry under the build
context root regardless of .dockerignore rules — a permission-denied
directory anywhere in that tree aborts the whole context transfer, even
when .dockerignore would ultimately exclude it. Verified empirically:
fixing .dockerignore alone does not resolve the build failure; removing
the directory from the build context (named volume) does.
Switch Postgres's volume from a bind mount to the named Docker volume
testplanit-postgres-data across all three compose files, so its data
directory can never live inside the build context. Also fix the
.dockerignore inconsistency across the three ignore files as a
secondary hygiene fix, even though it isn't sufficient on its own.
Existing deployments need a one-time migration (documented in
docker-setup.md) to move their bind-mounted data into the named volume
and remove the old directory, since a leftover 0700 directory would
still break the build even after upgrading.
* feat(docker): bump Postgres from 15 to 18
15 is three majors behind current stable (18.4). No blocking compatibility
issues found: the app only uses the pg_trgm extension (stable since early
Postgres releases), and the audit trigger installer uses only long-standing
PL/pgSQL/SQL constructs. Verified against a real Postgres 18 instance: Prisma
client generation, `prisma db push`, all 69 audit triggers, and the full demo
seed all complete cleanly, and data survives a container restart.
Postgres 18's official image changed its default PGDATA to a version-specific
subdirectory and expects the volume mounted at /var/lib/postgresql instead of
.../data (docker-library/postgres#1259). Pin PGDATA back to the old flat path
so the existing named-volume mount doesn't need to change on every future
major bump, and to sidestep a still-open detection bug in the new layout
(docker-library/postgres#1400) that reproduced reliably in local testing.
Existing deployments need a real pg_dump/pg_restore migration, not a raw file
copy — Postgres 18 can't read a Postgres 15 data directory. Documented
alongside the named-volume migration note, since both land in the same
upgrade.
0 commit comments