Mingle Li
Mingle Li

Reputation: 1370

Gitlab 500 Error: PG::ConnectionBad

I'm running Gitlab-CE v8.11.3-ce.1

My house lost power, and so that abruptly shut down my Gitlab server. I power it back on, and it gives me a 500 error. When I do sudo gitlab-ctl reconfigure, I'm getting this in the log:

[execute] psql: could not connect to server: Connection refused
            Is the server running locally and accepting
            connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?

Here's my database section of gitlab.rb:

# gitlab_rails['db_adapter'] = "postgresql"
# gitlab_rails['db_encoding'] = "unicode"
# gitlab_rails['db_collation'] = nil
# gitlab_rails['db_database'] = "gitlabhq_production"
# gitlab_rails['db_pool'] = 10
# gitlab_rails['db_username'] = "gitlab"
# gitlab_rails['db_password'] = nil
# gitlab_rails['db_host'] = nil
# gitlab_rails['db_port'] = 5432
# gitlab_rails['db_socket'] = nil
# gitlab_rails['db_sslmode'] = nil
# gitlab_rails['db_sslrootcert'] = nil

I didn't change any host or anything. Help.

Upvotes: 2

Views: 5869

Answers (1)

Mingle Li
Mingle Li

Reputation: 1370

Thanks to @twk3 for solving my question! https://gitlab.com/gitlab-org/omnibus-gitlab/issues/1637

Solution:

sudo gitlab-ctl stop
sudo systemctl stop gitlab-runsvdir.service
ps aux | grep postgre (check if there are any postgres processes; shouldn't be)
sudo rm /var/opt/gitlab/postgresql/data/postmaster.pid
sudo systemctl start gitlab-runsvdir.service
sudo gitlab-ctl reconfigure

And it works!

Upvotes: 9

Related Questions