Support PostgreSQL 18+ properly, guard existing data against version bumps#38
Open
jannefleischer wants to merge 1 commit into
Open
Support PostgreSQL 18+ properly, guard existing data against version bumps#38jannefleischer wants to merge 1 commit into
jannefleischer wants to merge 1 commit into
Conversation
…bumps Closes the gap left by pinning POSTGRES_VERSION to 16 as a workaround (github.com/rdmorganiser#35): postgres 18 needs the volume mounted a level up, at /var/lib/postgresql (it manages its own version-named subdirectory there), instead of directly at .../data. - Add POSTGRES_DATA_MOUNT (default: /var/lib/postgresql/data, i.e. unchanged behavior for every existing deployment) to control the postgres volume's container-side mount target. Set it to /var/lib/postgresql alongside POSTGRES_VERSION=18 (or newer) to use the new layout. Verified both a default (16) fresh deploy and an 18 fresh deploy end to end. - fixperms (docker/fixperms/fixperms.sh) now also compares the PostgreSQL major version already on disk against POSTGRES_VERSION before touching anything. Major-version upgrades need pg_dump/pg_restore (or pg_upgrade with both binaries present) - a bind-mount layout change alone doesn't convert the on-disk format, and 18 can't read a 16 data directory. On a mismatch, fixperms backs up vol/postgres to a timestamped .tar.gz and exits non-zero, which blocks postgres/rdmo/caddy from starting at all (verified: they stay in "Created", never start). This turns "silently read the wrong data or quietly initialize a second, empty database" into "stop cold, with a backup and an explanation". - Documented the manual pg_dump/pg_restore upgrade path in readme.md. Verified against the real, already-running deployment (POSTGRES_VERSION=15 in its .env): fixperms correctly reports a version match and changes nothing.
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.
Closes the gap left by pinning POSTGRES_VERSION to 16 as a workaround (github.com/#35): postgres 18 needs the volume mounted a level up, at /var/lib/postgresql (it manages its own version-named subdirectory there), instead of directly at .../data.
Verified against the real, already-running deployment (POSTGRES_VERSION=15 in its .env): fixperms correctly reports a version match and changes nothing.