Error 502 after gitlab upgrade

Gitlab is installed on Debian. Upgrade with sudo apt-get upgrade, new version is 10.5.3-ce.0.

After upgrade, I get
502
Whoops, GitLab is taking too much time to respond.

When running gitlab-ctl reconfigure, I get this error:

There was an error running gitlab-ctl reconfigure:

bash[migrate gitlab-rails database] (gitlab::database_migrations line 49) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’
---- Begin output of “bash” “/tmp/chef-script20180306-29372-15ca70b” ----
STDOUT: rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/opt/gitlab/postgresql/.s.PGSQL.5432”?
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:in load’
/opt/gitlab/embedded/bin/bundle:23:in `’
Tasks: TOP => gitlab:db:configure
(See full trace by running task with --trace)
STDERR:
---- End output of “bash” “/tmp/chef-script20180306-29372-15ca70b” ----
Ran “bash” “/tmp/chef-script20180306-29372-15ca70b” returned 1

Please advise.

Content of /var/opt/gitlab/postgresql, because the error mentioned Unix domain socket “/var/opt/gitlab/postgresql/.s.PGSQL.5432”

drwxr-xr-x  4 gitlab-psql root         107 Mar  6 11:13 .
drwxr-xr-x 18 root        root        4096 Mar  6 11:04 ..
-rw-------  1 gitlab-psql root          52 Nov 21  2016 .profile
-rwx------  1 gitlab-psql gitlab-psql  767 Mar 20  2017 analyze_new_cluster.sh
drwx------ 19 gitlab-psql gitlab-psql 4096 Mar  6 11:13 data
drwx------ 14 gitlab-psql root        4096 Mar 20  2017 data.9.2.18
-rwx------  1 gitlab-psql gitlab-psql   52 Mar 20  2017 delete_old_cluster.sh

So to my understanding, Gitlab has an embedded postgresql database, and Gitlab is unable to connect to that embedded postgresql database, because it expects to find a Unix socket file, which does not exist?

Is that correct?