No postgresql connection in 13.0.14-ce.0 container

I’m attempting to upgrade a containerized Gitlab 12.10.14-ce.0 to version 13.0.14-ce.0
I’ve made it this far from 10.6.3-ce.0 using the migration path

After starting the container each time I exec into it and run gitlab-rake gitlab:check. If there’s no red, I stop the container, and change the gitlab version to the next one and start that container

services:
  gitlab:
    image: 'gitlab/gitlab-ce:${GITLAB_VERSION}'
    restart: 'no'
    hostname: "${GITLAB_HOST}"
    volumes:
      - './config:/etc/gitlab'
      - './logs:/var/log/gitlab'
      - './data:/var/opt/gitlab'
    ports:
    - "${GITLAB_HOST}:2222:22" 

But with version 13.0.14-ce.0 when I start up the container I get

gitlab-1  | Recipe: gitlab::database_migrations
gitlab-1  |   * bash[migrate gitlab-rails database] action run
gitlab-1  |     [execute] rake aborted!
gitlab-1  |               PG::ConnectionBad: could not connect to server: No such file or directory
gitlab-1  |                 Is the server running locally and accepting
gitlab-1  |                 connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
gitlab-1  |               /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:48:in `block (3 levels) in <top (required)>'
gitlab-1  |               /opt/gitlab/embedded/bin/bundle:23:in `load'
gitlab-1  |               /opt/gitlab/embedded/bin/bundle:23:in `<main>'
gitlab-1  |               Tasks: TOP => gitlab:db:configure
gitlab-1  |               (See full trace by running task with --trace)

PostgreSQL might take a while to start, depending on the resources available. How much RAM and CPUs are assigned to the Docker Host?

Another guess - the host system being RHEL/Fedora, where SELinux could interfere with socket creation.

It might also be the case that 13.x requires a newer PostgreSQL major version, and the bundled upgrade failed for some reason. git - gitlab-ce docker - "PG::ConnectionBad: could not connect to server: No such file or directory" - Stack Overflow has some great debugging steps.

1 Like

Ok thanks that link put me on the right track. FWIW:

shows that for version 13.0

Package upgrades aborted if users not running PostgreSQL 11 already

and version 12.8

Users can manually upgrade to 11.7 following the upgrade documentation.