Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 975
Mingle Li Avatar asked Sep 21 '26 03:09

Mingle Li


1 Answers

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!

like image 114
Mingle Li Avatar answered Sep 23 '26 19:09

Mingle Li



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!