V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
nonesuccess
V2EX  ›  程序员

请教一个 centos6 上安装 gitlab 的问题, gitlab-ctl reconfigure 时报错

  •  
  •   nonesuccess · 2017-10-29 10:35:45 +08:00 · 12251 次点击
    这是一个创建于 2586 天前的主题,其中的信息可能已经有所发展或是发生改变。

    安装过程(隐去 ip )

      929  curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
      931  sudo EXTERNAL_URL="http://113.xxx.xxx.xxx:xxx" yum -y install gitlab-ce
    

    执行后,按照文档,应该已经可以运行了,但是无法访问。

    执行 gitlab-ctl status,显示如下内容:

    down: postgresql: 1s, normally up, want up; run: log: (pid 22114) 48669s
    run: redis: (pid 22115) 48669s; run: log: (pid 22113) 48669s
    

    执行 gitlab-ctl reconfigure,报错如下:

     [0m
    ================================================================================ [0m
     [31mError executing action `run` on resource 'bash[migrate gitlab-rails database]' [0m
    ================================================================================ [0m
    
     [0mMixlib::ShellOut::ShellCommandFailed [0m
    ------------------------------------ [0m
    Expected process to exit with [0], but received '1'
     [0m---- Begin output of "bash"  "/tmp/chef-script20171029-6188-16jte6z" ----
     [0mSTDOUT: rake aborted!
     [0mPG::ConnectionBad: could not connect to server: No such file or directory
     [0m	Is the server running locally and accepting
     [0m	connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
     [0m/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in `block (3 levels) in <top (required)>'
     [0m/opt/gitlab/embedded/bin/bundle:23:in `load'
     [0m/opt/gitlab/embedded/bin/bundle:23:in `<main>'
     [0mTasks: TOP => gitlab:db:configure
     [0m(See full trace by running task with --trace)
     [0mSTDERR: 
     [0m---- End output of "bash"  "/tmp/chef-script20171029-6188-16jte6z" ----
     [0mRan "bash"  "/tmp/chef-script20171029-6188-16jte6z" returned 1 [0m
    
     [0mResource Declaration: [0m
    --------------------- [0m
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
     [0m
     [0m 51: bash "migrate gitlab-rails database" do
     [0m 52:   code <<-EOH
     [0m 53:     set -e
     [0m 54:     log_file="#{node['gitlab']['gitlab-rails']['log_directory']}/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log"
     [0m 55:     umask 077
     [0m 56:     /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}
     [0m 57:     STATUS=${PIPESTATUS[0]}
     [0m 58:     echo $STATUS > #{db_migrate_status_file}
     [0m 59:     exit $STATUS
     [0m 60:   EOH
     [0m 61:   environment env_variables unless env_variables.empty?
     [0m 62:   notifies :run, 'execute[enable pg_trgm extension]', :before if omnibus_helper.service_enabled?('postgresql')
     [0m 63:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
     [0m 64:   dependent_services.each do |svc|
     [0m 65:     notifies :restart, svc, :immediately
     [0m 66:   end
     [0m 67:   not_if "(test -f #{db_migrate_status_file}) && (cat #{db_migrate_status_file} | grep -Fx 0)"
     [0m 68:   only_if { node['gitlab']['gitlab-rails']['auto_migrate'] }
     [0m 69: end
     [0m
     [0mCompiled Resource: [0m
    ------------------ [0m
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
     [0m
     [0mbash("migrate gitlab-rails database") do
     [0m  action [:run]
     [0m  updated true
     [0m  retries 0
     [0m  retry_delay 2
     [0m  default_guard_interpreter :default
     [0m  command "migrate gitlab-rails database"
     [0m  backup 5
     [0m  returns 0
     [0m  code "    set -e\n    log_file=\"/var/log/gitlab/gitlab-rails/gitlab-rails-db-migrate-$(date +%Y-%m-%d-%H-%M-%S).log\"\n    umask 077\n    /opt/gitlab/bin/gitlab-rake gitlab:db:configure 2>& 1 | tee ${log_file}\n    STATUS=${PIPESTATUS[0]}\n    echo $STATUS > /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-5a695c4\n    exit $STATUS\n"
     [0m  interpreter "bash"
     [0m  declared_type :bash
     [0m  cookbook_name "gitlab"
     [0m  recipe_name "database_migrations"
     [0m  not_if "(test -f /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-5a695c4) && (cat /var/opt/gitlab/gitlab-rails/upgrade-status/db-migrate-873248b1f0d3a7a5535771a3a1635803-5a695c4 | grep -Fx 0)"
     [0m  only_if { #code block }
     [0mend
     [0m
     [0mPlatform: [0m
    --------- [0m
    x86_64-linux [0m
    
     [0m
    
    

    看样子是 postgresql 出的问题,网上查到了一些 kill 掉 postgresql 再重启的方案,尝试了一下,也没有作用。而且 ps aux | grep postgresql 也看不出有 postgresql 的进程:

     ps aux | grep postgresql
    niyuzhe   8160  0.0  0.0 103268   884 pts/1    S+   10:34   0:00 grep postgresql
    root     22112  0.0  0.0   3940   412 ?        Ss   Oct28   0:22 runsv postgresql
    root     22114  0.0  0.0   4084   572 ?        S    Oct28   0:03 svlogd -tt /var/log/gitlab/postgresql
    

    请问大家这是怎么回事,对 gitlab 的部署结构不太了解,没思路做进一步分析了

    13 条回复    2017-10-30 02:03:12 +08:00
    is
        1
    is  
       2017-10-29 11:09:00 +08:00
    如果只是为了用,装个新一点的系统直接用 Docker 吧,用 composer 直接起来就好了,很方便的。
    tlday
        2
    tlday  
       2017-10-29 11:16:55 +08:00 via Android
    @is centos6 的 docker 官方很久没更新了,docker 官方和 RedHat 互相甩锅。所以不建议用 centos6,6 的技术支持也快到期了。
    看起来是数据库的问题,可以试试能不能手动连上
    gwind
        3
    gwind  
       2017-10-29 11:24:11 +08:00
    不建议折腾

    简单点:
    1. 最新的稳定发型版 (CentOS 7+, Ubuntu 16.04+)
    2. Docker
    3. gitlab-ce

    复杂点(更符合生产原则):

    1. Kubernetes
    2. Helm
    nonesuccess
        4
    nonesuccess  
    OP
       2017-10-29 11:41:10 +08:00
    @gwind @tlday @is

    这台服务器上有挺多程序在跑着,升级的话是不是只能全格了再重新装?
    mrcn
        5
    mrcn  
       2017-10-29 12:09:01 +08:00 via Android
    centos6 基本上只能装 epel 源的 docker-io,可以试一下这个版本的 Docker 能不能用。
    wuYin
        6
    wuYin  
       2017-10-29 12:12:15 +08:00 via Android
    看报错无法创建 gitlab-rails 数据库,因为无连接。看下你 gitlab 的配置文件的数据库连接怎么写的?
    gwind
        7
    gwind  
       2017-10-29 12:20:56 +08:00
    @nonesuccess 遇到过这种情况,如果不想大动(风险更多),机器性能又不错,可以考虑虚拟化+Docker 方式
    Parallel
        8
    Parallel  
       2017-10-29 12:26:53 +08:00
    You need at least 4GB of addressable memory (RAM + swap) to install.
    defunct9
        9
    defunct9  
       2017-10-29 12:33:31 +08:00 via iPhone
    给 ssh,上去帮你搞定
    tlday
        10
    tlday  
       2017-10-29 13:05:52 +08:00 via Android
    @nonesuccess centos6 没有平滑升级 7 的工具,官方以前有一个,也很久没更新了,上面有个 notice 说,不建议再使用这个工具,所以估计你如果想升级,只能重新装
    jyf007
        11
    jyf007  
       2017-10-29 13:06:16 +08:00
    我怀疑你是我司的某个程序员,或者另一个运维
    is
        12
    is  
       2017-10-29 14:27:25 +08:00
    +1 @gwind 先跑个虚拟机吧,看起来是大机器.

    从 Centos 6 升级到 Centos 7 动静还是很大,平滑升级就不容易,还要考虑其它应用的兼容性。
    pynix
        13
    pynix  
       2017-10-30 02:03:12 +08:00 via iPhone
    公司穷成这样,装个 gitblab 云服务器或者刀片都舍不得?还有和现有服务挤在一起。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1006 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 21:23 · PVG 05:23 · LAX 13:23 · JFK 16:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.