记一次Gitlab升级, 14.6.0-ee到14.10.0-ee

发布时间:2023-10-31 16:00

升级原因:Gitlab无法删除项目,点删除按钮后项目依然存在,打开后提示“No repository”,(不确定是否这个版本问题,想通过版本升级重装一遍看能否解决问题)

升级过程:

时间:2022-04-27 当前最新版本GitLab Enterprise Edition 14.10.0-ee

1、官方指导说升级到最新版本直接

yum install -y gitlab-ee

Create a GitLab upgrade plan | GitLab

但是,我这儿执行后,提示没有可升级内容Nothing to do ,但是查看我的版本是14.6.0并不是最新版本;

于是按照安装时的步骤,重新添加安装包库

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

再次yum install -y gitlab-ee 正常升级安装

2、程序运行完成后,Gitlab无法访问,运行日志显示升级过程有错误,信息如下:

Recipe: gitlab::database_migrations
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
  * rails_migration[gitlab-rails] action run
    * bash[migrate gitlab-rails database] action run
 =========================================================================
      Error executing action `run` on resource \'bash[migrate gitlab-rails database]\'
 =========================================================================
      Mixlib::ShellOut::ShellCommandFailed
      ------------------------------------
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
      
      Resource Declaration:
      ---------------------
      suppressed sensitive resource output
      
      Compiled Resource:
      ------------------
      suppressed sensitive resource output
      
      System Info:
      ------------
      chef_version=15.17.4
      platform=centos
      platform_version=7.9.2009
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
      program_name=/opt/gitlab/embedded/bin/chef-client
      executable=/opt/gitlab/embedded/bin/chef-client
  ========================================================================
    Error executing action `run` on resource \'rails_migration[gitlab-rails]\'
 =========================================================================
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
    
    Resource Declaration:
    ---------------------
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
    
     51: rails_migration \"gitlab-rails\" do
     52:   rake_task \'gitlab:db:configure\'
     53:   logfile_prefix \'gitlab-rails-db-migrate\'
     54:   helper migration_helper
     55: 
     56:   environment env_variables
     57:   dependent_services dependent_services
     58:   notifies :run, \"execute[clear the gitlab-rails cache]\", :immediately
     59:   notifies :run, \"ruby_block[check remote PG version]\", :immediately
     60: 
     61:   only_if { migration_helper.attributes_node[\'auto_migrate\'] }
     62: end
    
    Compiled Resource:
    ------------------
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file\'
    
    rails_migration(\"gitlab-rails\") do
      action [:run]
      default_guard_interpreter :default
      declared_type :rails_migration
      cookbook_name \"gitlab\"
      recipe_name \"database_migrations\"
      rake_task \"gitlab:db:configure\"
      logfile_prefix \"gitlab-rails-db-migrate\"
      helper \"*sensitive value suppressed*\"
      environment \"*sensitive value suppressed*\"
      dependent_services []
      only_if { #code block }
    end
    
    System Info:
    ------------
    chef_version=15.17.4
    platform=centos
    platform_version=7.9.2009
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
    program_name=/opt/gitlab/embedded/bin/chef-client
    executable=/opt/gitlab/embedded/bin/chef-client
    
Recipe: gitlab::gitlab-rails
  * execute[clear the gitlab-rails cache] action run
    - execute /opt/gitlab/bin/gitlab-rake cache:clear
Recipe: gitaly::enable
  * runit_service[gitaly] action hup
    - send hup to runit_service[gitaly]
Recipe: gitlab-kas::enable
  * runit_service[gitlab-kas] action restart (up to date)

Running handlers:
There was an error running gitlab-ctl reconfigure:

rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource


Notes:
Found old initial root password file at /etc/gitlab/initial_root_password and deleted it.

Running handlers complete
Chef Infra Client failed. 56 resources updated in 01 minutes 07 seconds

Notes:
Found old initial root password file at /etc/gitlab/initial_root_password and deleted it.

===
There was an error running gitlab-ctl reconfigure. Please check the output above for more
details.
===
warning: %posttrans(gitlab-ee-14.10.0-ee.0.el7.x86_64) scriptlet failed, exit status 1
Non-fatal POSTTRANS scriptlet failure in rpm package gitlab-ee-14.10.0-ee.0.el7.x86_64
  Verifying  : gitlab-ee-14.10.0-ee.0.el7.x86_64                                                                                                                                                                                                                          1/2 
  Verifying  : gitlab-ee-14.6.0-ee.0.el7.x86_64                                                                                                                                                                                                                           2/2 

Updated:
  gitlab-ee.x86_64 0:14.10.0-ee.0.el7                                                                                                                                                                                                                                         

Complete!

按提示看应该是有迁移过程失败,手动执行迁移命令,并打印详细信息

gitlab-rake db:migrate --trace

会提示出错误原因,我的执行后给出了解决办法:

sudo gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,\'[null\\,\"up\"]\']

然后执行:gitlab-rake db:migrate:status 查看迁移状态,此时都up了,至此升级问题解决完成

3、执行 gitlab-ctl reconfigure 重新配置,配置后无法访问

gitlab-ctl tail 后查看日志502 

/var/opt/gitlab/gitlab-rails/sockets/gitlab.socketconnectconnection refused\"

重启后解决

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号