-
Notifications
You must be signed in to change notification settings - Fork 119
pg_hba.conf does not match postgres image #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Crap, looks like we need to shell out to "docker-entrypoint.sh" for initdb
somehow, which might actually require something like "docker-initdb" to be
created from just those initdb lines.
A workaround would be to run the image you're trying to move to on your new
data directory first so that the real initdb is run, then stop it, and run
the upgrade image.
|
@tianon I've changed db setup so it looks like this: master...CvX:new-db-setup-fix#diff-cd39faa12723607353bf74d281b3ed73 |
Future changes to that script could technically break it, but it's probably
generally safe. 👍
|
- Heavily inspired by this proof-of-concept repo - https://github.com/tianon/docker-postgres-upgrade - This issue has a fix for running it on Raspberry Pi - tianon/docker-postgres-upgrade#13 - profiles is used in compose to ensure the service isn't run by default - https://docs.docker.com/compose/profiles/ - https://stackoverflow.com/a/65957695/2421313 - Update deploy script to push/pull default services and services with the runManually profile - Must create db-15 service so that permissions are initialized correctly for the new empty database - tianon/docker-postgres-upgrade#1 (comment) - Manual commands ```sh # Must run db-15 at least once to init the empty db dc up --build --detach # Old db cannot be running or else pg_upgrade will fail to start dc down # This only takes 10-15 seconds dc run db-upgrade # Do not restart services until after the next commit ``` - Upgrade output logs ``` Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database user is the install user ok Checking database connection settings ok Checking for prepared transactions ok Checking for system-defined composite types in user tables ok Checking for reg* data types in user tables ok Checking for contrib/isn with bigint-passing mismatch ok Creating dump of global objects ok Creating dump of database schemas ok Checking for presence of required libraries ok Checking database user is the install user ok Checking for prepared transactions ok Checking for new cluster tablespace directories ok If pg_upgrade fails after this point, you must re-initdb the new cluster before continuing. Performing Upgrade ------------------ Analyzing all rows in the new cluster ok Freezing all rows in the new cluster ok Deleting files from new pg_xact ok Copying old pg_xact to new server ok Setting oldest XID for new cluster ok Setting next transaction ID and epoch for new cluster ok Deleting files from new pg_multixact/offsets ok Copying old pg_multixact/offsets to new server ok Deleting files from new pg_multixact/members ok Copying old pg_multixact/members to new server ok Setting next multixact ID and offset for new cluster ok Resetting WAL archives ok Setting frozenxid and minmxid counters in new cluster ok Restoring global objects in the new cluster ok Restoring database schemas in the new cluster ok Adding ".old" suffix to old global/pg_control ok If you want to start the old cluster, you will need to remove the ".old" suffix from /var/lib/postgresql/14/data/global/pg_control.old. Because "link" mode was used, the old cluster cannot be safely started once the new cluster has been started. Linking user relation files ok Setting next OID for new cluster ok Sync data directory to disk ok Creating script to delete old cluster ok Checking for extension updates ok Upgrade Complete ---------------- Optimizer statistics are not transferred by pg_upgrade. Once you start the new server, consider running: /usr/lib/postgresql/15/bin/vacuumdb --all --analyze-in-stages Running this script will delete the old cluster's data files: ./delete_old_cluster.sh ```
- Heavily inspired by this proof-of-concept repo - https://github.com/tianon/docker-postgres-upgrade - This issue has a fix for running it on Raspberry Pi - tianon/docker-postgres-upgrade#13 - profiles is used in compose to ensure the service isn't run by default - https://docs.docker.com/compose/profiles/ - https://stackoverflow.com/a/65957695/2421313 - Update deploy script to push/pull default services and services with the runManually profile - Must create db-15 service so that permissions are initialized correctly for the new empty database - tianon/docker-postgres-upgrade#1 (comment) - Manual commands ```sh # Must run db-15 at least once to init the empty db dc up --build --detach # Old db cannot be running or else pg_upgrade will fail to start dc down # This only takes 10-15 seconds dc run db-upgrade # Do not restart services until after the next commit ``` - Upgrade output logs ``` Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database user is the install user ok Checking database connection settings ok Checking for prepared transactions ok Checking for system-defined composite types in user tables ok Checking for reg* data types in user tables ok Checking for contrib/isn with bigint-passing mismatch ok Creating dump of global objects ok Creating dump of database schemas ok Checking for presence of required libraries ok Checking database user is the install user ok Checking for prepared transactions ok Checking for new cluster tablespace directories ok If pg_upgrade fails after this point, you must re-initdb the new cluster before continuing. Performing Upgrade ------------------ Analyzing all rows in the new cluster ok Freezing all rows in the new cluster ok Deleting files from new pg_xact ok Copying old pg_xact to new server ok Setting oldest XID for new cluster ok Setting next transaction ID and epoch for new cluster ok Deleting files from new pg_multixact/offsets ok Copying old pg_multixact/offsets to new server ok Deleting files from new pg_multixact/members ok Copying old pg_multixact/members to new server ok Setting next multixact ID and offset for new cluster ok Resetting WAL archives ok Setting frozenxid and minmxid counters in new cluster ok Restoring global objects in the new cluster ok Restoring database schemas in the new cluster ok Adding ".old" suffix to old global/pg_control ok If you want to start the old cluster, you will need to remove the ".old" suffix from /var/lib/postgresql/14/data/global/pg_control.old. Because "link" mode was used, the old cluster cannot be safely started once the new cluster has been started. Linking user relation files ok Setting next OID for new cluster ok Sync data directory to disk ok Creating script to delete old cluster ok Checking for extension updates ok Upgrade Complete ---------------- Optimizer statistics are not transferred by pg_upgrade. Once you start the new server, consider running: /usr/lib/postgresql/15/bin/vacuumdb --all --analyze-in-stages Running this script will delete the old cluster's data files: ./delete_old_cluster.sh ```
- Heavily inspired by this proof-of-concept repo - https://github.com/tianon/docker-postgres-upgrade - This issue has a fix for running it on Raspberry Pi - tianon/docker-postgres-upgrade#13 - profiles is used in compose to ensure the service isn't run by default - https://docs.docker.com/compose/profiles/ - https://stackoverflow.com/a/65957695/2421313 - Update deploy script to push/pull default services and services with the runManually profile - Must create db-15 service so that permissions are initialized correctly for the new empty database - tianon/docker-postgres-upgrade#1 (comment) - Manual commands ```sh # Must run db-15 at least once to init the empty db dc up --build --detach # Old db cannot be running or else pg_upgrade will fail to start dc down # This only takes 10-15 seconds dc run db-upgrade # Do not restart services until after the next commit ``` - Upgrade output logs ``` Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database user is the install user ok Checking database connection settings ok Checking for prepared transactions ok Checking for system-defined composite types in user tables ok Checking for reg* data types in user tables ok Checking for contrib/isn with bigint-passing mismatch ok Creating dump of global objects ok Creating dump of database schemas ok Checking for presence of required libraries ok Checking database user is the install user ok Checking for prepared transactions ok Checking for new cluster tablespace directories ok If pg_upgrade fails after this point, you must re-initdb the new cluster before continuing. Performing Upgrade ------------------ Analyzing all rows in the new cluster ok Freezing all rows in the new cluster ok Deleting files from new pg_xact ok Copying old pg_xact to new server ok Setting oldest XID for new cluster ok Setting next transaction ID and epoch for new cluster ok Deleting files from new pg_multixact/offsets ok Copying old pg_multixact/offsets to new server ok Deleting files from new pg_multixact/members ok Copying old pg_multixact/members to new server ok Setting next multixact ID and offset for new cluster ok Resetting WAL archives ok Setting frozenxid and minmxid counters in new cluster ok Restoring global objects in the new cluster ok Restoring database schemas in the new cluster ok Adding ".old" suffix to old global/pg_control ok If you want to start the old cluster, you will need to remove the ".old" suffix from /var/lib/postgresql/14/data/global/pg_control.old. Because "link" mode was used, the old cluster cannot be safely started once the new cluster has been started. Linking user relation files ok Setting next OID for new cluster ok Sync data directory to disk ok Creating script to delete old cluster ok Checking for extension updates ok Upgrade Complete ---------------- Optimizer statistics are not transferred by pg_upgrade. Once you start the new server, consider running: /usr/lib/postgresql/15/bin/vacuumdb --all --analyze-in-stages Running this script will delete the old cluster's data files: ./delete_old_cluster.sh ```
just realized that the pg_hba.conf file is different in the data folder of two postgres versions |
This means that anything not connecting via the local socket will fail, so most applications linking the postgres container will not work.
At least for me,
pg_hba.conf
was missing this:Normally this would be set up in
https://github.com/docker-library/postgres/blob/master/9.5/docker-entrypoint.sh
, but because we useinitdb
during the upgrade, that never happens.The text was updated successfully, but these errors were encountered: