无法使用omnibus安装gitlab:在资源'bash [migrate gitlab-rails database]上执行动作`run`时出错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法使用omnibus安装gitlab:在资源'bash [migrate gitlab-rails database]上执行动作`run`时出错相关的知识,希望对你有一定的参考价值。

我之前已经安装了gitlab,这是一个非常简单的过程,在过去的一周,然而网站上的流程概述在sudo EXTERNAL_URL="http://gitlab.example.com" apt-get install gitlab-ee步骤失败了。

看到的错误:

    ================================================================================
    Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of "bash"  "/tmp/chef-script20171024-7894-1sl10lo" ----
    STDOUT: rake aborted!
    PG::ConnectionBad: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
    /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in `block (3 levels) in <top (required)>'
    /opt/gitlab/embedded/bin/bundle:23:in `load'
    /opt/gitlab/embedded/bin/bundle:23:in `<main>'
    Tasks: TOP => gitlab:db:configure
    (See full trace by running task with --trace)
    STDERR: 
    ---- End output of "bash"  "/tmp/chef-script20171024-7894-1sl10lo" ----
    Ran "bash"  "/tmp/chef-script20171024-7894-1sl10lo" returned 1

    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb

     51: bash "migrate gitlab-rails database" do
     52:   code <<-EOH
     53:     set -e
     54:     log_file="#{node['gitlab']['gitlab-rails']['log_directory']}/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log"
     55:     umask 077
     56:     /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}
     57:     STATUS=${PIPESTATUS[0]}
     58:     echo $STATUS > #{db_migrate_status_file}
     59:     exit $STATUS
     60:   EOH
     61:   environment env_variables unless env_variables.empty?
     62:   notifies :run, 'execute[enable pg_trgm extension]', :before if omnibus_helper.service_enabled?('postgresql')
     63:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
     64:   dependent_services.each do |svc|
     65:     notifies :restart, svc, :immediately
     66:   end
     67:   not_if "(test -f #{db_migrate_status_file}) && (cat #{db_migrate_status_file} | grep -Fx 0)"
     68:   only_if { node['gitlab']['gitlab-rails']['auto_migrate'] }
     69: end

    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'

    bash("migrate gitlab-rails database") do
      action [:run]
      updated true
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      command "migrate gitlab-rails database"
      backup 5
      returns 0
      code "    set -e
    log_file="/var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log"
    umask 077
    /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}
    STATUS=${PIPESTATUS[0]}
    echo $STATUS > /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-3a712c3
    exit $STATUS
"
      interpreter "bash"
      declared_type :bash
      cookbook_name "gitlab"
      recipe_name "database_migrations"
      not_if "(test -f /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-3a712c3) && (cat /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-3a712c3 | grep -Fx 0)"
      only_if { #code block }
    end

    Platform:
    ---------
    x86_64-linux


Running handlers:
Running handlers complete
Chef Client failed. 5 resources updated in 45 seconds
dpkg: error processing package gitlab-ee (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 gitlab-ee
E: Sub-process /usr/bin/dpkg returned an error code (1)

这是在Ubuntu 16.04LTS上。如何解决这个问题并安装gitlab?

我也尝试过使用旧方法安装gitlab(首先安装gitlab然后配置)但是它仍然在sudo gitlab-ctl reconfigure步骤失败了。

答案

通常信号137表示内存不足,请检查系统日志:

grep -i memory /var/log/messages

以上是关于无法使用omnibus安装gitlab:在资源'bash [migrate gitlab-rails database]上执行动作`run`时出错的主要内容,如果未能解决你的问题,请参考以下文章

centos6使用Omnibus方法安装gitlab

centos6使用Omnibus方法安装gitlab

GITLAB_OMNIBUS_CONFIG 环境变量不起作用?

omnibus gitlab-ce安装

使用HTTPS配置gitlab omnibus,无需在AWS上使用nginx证书

GitLab Omnibus 在“等”中缺少“nginx”文件夹