CircleCI-Public / cimg-postgres

MIT License
8 stars 25 forks source link

Build Postgres 9.6 images in addition to 13.4 #23

Closed nirojan closed 2 years ago

nirojan commented 3 years ago

This PR https://github.com/CircleCI-Public/cimg-postgres/pull/20 made some changes and as part of it, rebuilt 9.6 images. But then the changes were backed out in this PR https://github.com/CircleCI-Public/cimg-postgres/pull/22 due to issues. The back out change also removed the build commands for postgres 9.6 which resulted in just 13.4 getting rebuilt which undid the changes whereas 9.6 stuck with broken builds.

I am seeing error saying Postgres can't connect to Postgres Unix socket, same as here https://github.com/CircleCI-Public/cimg-postgres/issues/17#issuecomment-970113236

This PR adds those commands to rebuilt 9.6 images as well so users of Postgres 9.6 also have a working image.

FelicianoTech commented 3 years ago

Hi. I wish I saw this sooner. #24 has been merged which will hopefully fix this issue.

JUST IN CASE there's still a problem and/or another revert is needed, I'm going to leave this PR open.

FelicianoTech commented 3 years ago

Also, this PR didn't run because you are "not authorized". So I just ran the branch manually so we can see what the status will be.

nirojan commented 3 years ago

@felicianotech This PR was supposed to be a temporary fix to ensure a 9.6 image was built after the changes were reverted.

To fix test pipelines that were failing due to postgres image, we built the image ourselves using the reverted 9.6 Dockerfile and hosted it in our docker hub account.

Just did a quick test, and it fails with same error message as before. Full log

********************************************************************************
WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow
         anyone with access to the Postgres port to access your database without
         a password, even if POSTGRES_PASSWORD is set. See PostgreSQL
         documentation about "trust":
         https://www.postgresql.org/docs/current/auth-trust.html
         In Docker's default configuration, this is effectively any other
         container on the same system.

         It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace
         it with "-e POSTGRES_PASSWORD=password" instead to set a password in
         "docker run".
********************************************************************************
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Etc/UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/data -l logfile start

waiting for server to start....LOG:  database system was shut down at 2021-11-23 13:07:24 UTC
LOG:  MultiXact member wraparound protections are now enabled
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections
 done
server started
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
LOG:  received SIGHUP, reloading configuration files
LOG:  parameter "listen_addresses" cannot be changed without restarting the server
LOG:  configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors; unaffected changes were applied

Exited with code 2

CircleCI received exit code 2

The image circle pulled at the start of the job

cimg/postgres:9.6.23:
  using image cimg/postgres@sha256:7084fe94f492a9519553d17eabe3cd6ed6de3ee9b3a22032070d1f0f8861cd85
  pull stats: Image was already available so the image was not pulled
  time to create container: 124ms

This is the image that was built about 14 hours ago https://hub.docker.com/layers/cimg/postgres/9.6.23/images/sha256-7084fe94f492a9519553d17eabe3cd6ed6de3ee9b3a22032070d1f0f8861cd85?context=explore by this job https://app.circleci.com/pipelines/github/CircleCI-Public/cimg-postgres/62/workflows/e6323b1f-9944-4f5b-80ff-2220d97ea705/jobs/58

I was able to reproduce the same error with just docker run command as well

docker run cimg/postgres:9.6.23
FelicianoTech commented 2 years ago

Closing in favor or recent PRs.

@nirojan Can you confirm that with a fresh build, your pipeline works now?

v9.6.22 should be ready and v9.6.23 will be updated within an hour or so.