I was able to dump with this method:
docker exec bayden10_db_1 /usr/local/bin/pg_dump -Fd postgres -U postgres -f /var/lib/postgresql/data/dump.sql
I then tried to upgrade by way of the following
docker-compose down cp -a db db.bak mv db/production/dump.sql . rm -r db/
nano docker-compose.yml
Change 9.6-alpine to 13.2-alpine
docker-compose up -d
Then I’m seeing error with authentication on the default db:
docker logs -f bayden10_db_1
2021-03-18 15:30:57.874 UTC [1] LOG: starting PostgreSQL 13.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.2.1_pre1) 10.2.1 20201203, 64-bit
2021-03-18 15:30:57.874 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
2021-03-18 15:30:57.874 UTC [1] LOG: listening on IPv6 address “::”, port 5432
2021-03-18 15:30:57.880 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
2021-03-18 15:30:57.888 UTC [48] LOG: database system was shut down at 2021-03-18 15:30:57 UTC
2021-03-18 15:30:57.893 UTC [1] LOG: database system is ready to accept connections
2021-03-18 15:30:58.573 UTC [55] LOG: invalid length of startup packet
2021-03-18 15:31:06.198 UTC [56] FATAL: password authentication failed for user “postgres”
2021-03-18 15:31:06.198 UTC [56] DETAIL: Password does not match for user “postgres”.
Connection matched pg_hba.conf line 99: “host all all all md5”
2021-03-18 15:31:09.552 UTC [57] FATAL: password authentication failed for user “postgres”
2021-03-18 15:31:09.552 UTC [57] DETAIL: Password does not match for user “postgres”.
Connection matched pg_hba.conf line 99: “host all all all md5”
I then modified pg_hba.conf to
host all all all trust
This then allowed the default db start. How ever when upgrading from dump.sql
docker exec greenlight_db_1 /usr/local/bin/psql -U postgres -c “DROP DATABASE greenlight_production;”
DROP DATABASE
then
cp dump.sql db/production/
docker exec greenlight_db_1 /usr/local/bin/psql -U postgres -f /var/lib/postgresql/data/dump.sql
psql:/var/lib/postgresql/data/dump.sql: error: could not read from input file: Is a directory
Do I need to do a custom dump here?