postgresql 用于 Postgres 的 GitLab Omnibus 配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23580268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 00:41:59  来源:igfitidea点击:

GitLab Omnibus configuration for Postgres

postgresqlgitlab

提问by kalabro

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

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

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

当我运行时,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"

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

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

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

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

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

How can I configure PostgreSQL options to install GitLab Omnibus?

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

回答by kalabro

I solved the problem with my existing PostgreSQL instance.

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

  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
    
  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
    

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

另一种变体是为内置 PostgreSQL 设置自定义端口:

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

This will run separate PostgreSQL instance on specified port.

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

回答by user1356863

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

我能够通过重命名 /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

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

然后我只是重新运行gitlab-ctl reconfigure然后成功运行的命令。

回答by lanni654321

you can use:

您可以使用:

cat >> /etc/gitlab/gitlab.rb << "EOF"

cat >> /etc/gitlab/gitlab.rb << "EOF"

postgresql['enable'] = true

postgresql['启用'] = 真

postgresql['port'] = 5432

postgresql['端口'] = 5432

postgresql['listen_address'] = "*"

postgresql['listen_address'] = "*"

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

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']

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

EOF

EOF

gitlab-ctl reconfigure

gitlab-ctl 重新配置

gitlab-ctl restart

gitlab-ctl 重启