Postgres的GitLab Omnibus配置

时间:2014-05-10 11:08:08

标签: postgresql gitlab

我试图在我的已经安装了Postgres 9.1的开发Debian 7(Wheezy)机器上安装gitlab_6.8.1-omnibus.4-1_amd64.deb

当我运行sudo gitlab-ctl reconfigure时,我发现错误:

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"

我在Postgres中创建了用户gitgitlab(包含密码gitgitlab),但它没有帮助。

/var/log/postgresql/postgresql-9.1-main.log充满了身份验证错误:

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

如何配置PostgreSQL选项以安装GitLab Omnibus?

3 个答案:

答案 0 :(得分:17)

我用现有的PostgreSQL实例解决了这个问题。

  1. 添加到/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. 运行sudo gitlab-ctl reconfigure

  3. 导入默认数据:

    sudo gitlab-rake gitlab:setup
    
  4. 替代变体是为内置PostgreSQL设置自定义端口:

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

    这将在指定端口上运行单独的PostgreSQL实例。

答案 1 :(得分:1)

我能够通过重命名已存在于/ var / opt / gitlab目录中的postgres目录来解决此问题:

[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

然后我重新调用gitlab-ctl reconfigure命令然后成功运行。

答案 2 :(得分:0)

您可以使用:

cat >> /etc/gitlab/gitlab.rb <<“ EOF”

postgresql ['enable'] = true

postgresql ['port'] = 5432

postgresql ['listen_address'] =“ *”

postgresql ['md5_auth_cidr_addresses'] = ['127.0.0.1/32','0.0.0.0/0',':: 1/128']

postgresql ['trust_auth_cidr_addresses'] = ['127.0.0.1/32',':: 1/128']

EOF

gitlab-ctl重新配置

gitlab-ctl重新启动