Access Bundled PostgreSQL in GitLab Omnibus Installation

Connection Details

  • Host: /var/opt/gitlab/postgresql
  • Socket: /var/opt/gitlab/postgresql/.s.PGSQL.5432
  • UNIX User: gitlab-psql
  • User: gitlab-psql
  • Password: (empty)
  • Database: gitlabhq_production

Shell

sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

Port forwarding (for Docker installation)

apt update && apt install -y socat
sudo -u gitlab-psql socat TCP-LISTEN:5432,reuseaddr,fork UNIX-CLIENT:/var/opt/gitlab/postgresql/.s.PGSQL.5432

References

/opt/gitlab/embedded/service/gitlab-rails/config/database.yml
# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.

production:
  adapter: postgresql
  encoding: unicode
  collation:
  database: gitlabhq_production
  pool: 10
  username: 'gitlab'
  password:
  host: '/var/opt/gitlab/postgresql'
  port: 5432
  socket:
  sslmode:
  sslrootcert:
  sslca:

See Alsos