Skip to content

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

Open
belak opened this issue Jun 10, 2016 · 4 comments
Open

pg_hba.conf does not match postgres image #1

belak opened this issue Jun 10, 2016 · 4 comments

Comments

@belak
Copy link

belak commented Jun 10, 2016

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:

host all all 0.0.0.0/0 md5

Normally this would be set up in https://github.com/docker-library/postgres/blob/master/9.5/docker-entrypoint.sh, but because we use initdb during the upgrade, that never happens.

@tianon
Copy link
Owner

tianon commented Jun 10, 2016 via email

@CvX
Copy link

CvX commented Dec 28, 2016

@tianon I've changed db setup so it looks like this: master...CvX:new-db-setup-fix#diff-cd39faa12723607353bf74d281b3ed73
That works for me. Are there any downsides to running postgres' docker-entrypoint.sh just like that?

@tianon
Copy link
Owner

tianon commented Feb 16, 2017 via email

High5Apps added a commit to High5Apps/organize-backend that referenced this issue Apr 25, 2023
- 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
```
High5Apps added a commit to High5Apps/organize-backend that referenced this issue Apr 28, 2023
- 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
```
High5Apps added a commit to High5Apps/organize-backend that referenced this issue Apr 28, 2023
- 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
```
@WalkerWalker
Copy link

just realized that the pg_hba.conf file is different in the data folder of two postgres versions
In my old postgres, The last linehost all all all md5 exists, but in my new postgres, this line does not exist.
Then I found this issue. So is it still open?

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

No branches or pull requests

4 participants