Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab Omnibus configuration for Postgres

I'm trying to install gitlab_6.8.1-omnibus.4-1_amd64.deb on my development Debian 7 (Wheezy) machine where Postgres 9.1 is already installed.

When I run sudo gitlab-ctl reconfigure I catch an error:

Error executing action `run` on resource 'execute[migrate database]'
    ======================================================================

    Mixlib::ShellOut::ShellCommandFailed  
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/bin/gitlab-rake db:migrate ----
STDOUT:
STDERR: WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
rake aborted!
FATAL:  password authentication failed for user "gitlab"
FATAL:  password authentication failed for user "gitlab"

I created both users git and gitlab (with passwords git and gitlab) in Postgres but it didn't help.

/var/log/postgresql/postgresql-9.1-main.log is full of authentication errors:

2014-05-10 14:51:30 MSK FATAL:  password authentication failed for user "gitlab"

How can I configure PostgreSQL options to install GitLab Omnibus?

like image 866
kalabro Avatar asked May 10 '14 11:05

kalabro


People also ask

Does GitLab use PostgreSQL?

GitLab supports only PostgreSQL database management system. Thus you have two options for database servers to use with Omnibus GitLab: Use the packaged PostgreSQL server included with Omnibus GitLab (no configuration required, recommended).

What is omnibus in GitLab?

Omnibus GitLab is a way to package different services and tools required to run GitLab, so that most users can install it without laborious configuration.

What does GitLab store in Postgres?

The GitLab application uses PostgreSQL for persistent database information (for example, users, permissions, issues, or other metadata). GitLab stores the bare Git repositories in the location defined in the configuration file, repositories: section.


2 Answers

I solved the problem with my existing PostgreSQL instance.

  1. Add to /etc/gitlab/gitlab.rb:

    # Disable the built-in Postgres
    postgresql['enable'] = false
    
    gitlab_rails['db_adapter'] = 'postgresql'
    gitlab_rails['db_encoding'] = 'unicode'
    # Create database manually and place its name here.
    gitlab_rails['db_database'] = 'gitlabhq_production'
    gitlab_rails['db_host'] = '127.0.0.1'
    gitlab_rails['db_port'] = '5432'
    gitlab_rails['db_username'] = 'git' # Database owner.
    gitlab_rails['db_password'] = 'git' # Database owner's password.
    
  2. Run sudo gitlab-ctl reconfigure.

  3. Import default data:

    sudo gitlab-rake gitlab:setup
    

Alternative variant is to set custom port for build-in PostgreSQL:

    postgresql['enable'] = true
    postgresql['port'] = 5433

This will run separate PostgreSQL instance on specified port.

like image 131
kalabro Avatar answered Oct 12 '22 11:10

kalabro


I was able to fix this issue by renaming the postgres directory that already existed in the /var/opt/gitlab directory:

[root@awsafinva1184:/var/opt/gitlab]#  ls -l 
total 52
drwx------ 2 git          root       4096 Dec  8 09:52 backups
-rw------- 1 root         root         38 Dec  8 09:52 bootstrapped
drwx------ 4 git          root       4096 Feb 20  2015 git-data
drwxr-xr-x 3 git          root       4096 Dec  8 09:52 gitlab-ci
drwxr-xr-x 8 git          root       4096 Dec  8 10:29 gitlab-rails
drwx------ 2 git          root       4096 Dec  8 10:29 gitlab-shell
drwxr-x--- 2 git          gitlab-www 4096 Dec  8 09:53 gitlab-workhorse
drwx------ 3 root         root       4096 Dec  8 10:02 logrotate
drwxr-x--- 8 root         gitlab-www 4096 Dec  8 10:06 nginx
drwxr-xr-x 3 gitlab-psql  root       4096 Dec  8 10:24 postgresql.org
drwxr-x--- 2 gitlab-redis git        4096 Dec  8 10:29 redis

Then I just reran the gitlab-ctl reconfigure command which then ran successfully.

like image 28
user1356863 Avatar answered Oct 12 '22 13:10

user1356863