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

本文记录了一次从GitLab 14.6.0升级到14.10.0过程中遇到的删除项目问题,升级失败后通过迁移操作解决了数据库错误,最终通过执行特定迁移脚本完成升级并处理了访问权限问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

升级原因: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"

重启后解决

### 安装 PostgreSQL 14 库文件 要正确安装 `postgresql14-libs-14.10-1PGDG.rhel7.x86_64.rpm` 包,可以按照以下方法操作: #### 使用 `rpm -ivh` 命令安装 执行以下命令来完成安装: ```bash rpm -ivh postgresql14-libs-14.10-1PGDG.rhel7.x86_64.rpm ``` 此命令会将指定的 RPM 包安装到系统中。如果存在依赖关系未满足的情况,则需要先解决这些依赖项。 --- #### 检查并处理依赖关系 在某些情况下,可能需要确认是否存在必要的依赖包(如 `libicu`)。可以通过以下命令检查已安装的 `libicu` 版本: ```bash rpm -qa | grep libicu ``` 如果没有找到对应的版本或者版本不匹配,则需手动下载并安装合适的 `libicu` 软件包[^2]。 对于 SSL 支持相关的依赖(如 `libssl.so.10`),也需要确保其已被正确安装[^3]。 --- #### 验证安装成功 安装完成后,可通过以下命令验证是否成功加载了所需的库文件: ```bash ldd /usr/pgsql-14/lib/postgresql/*.so | grep not\ found ``` 如果没有任何输出,则表示所有动态链接库均已正常加载;如果有缺失的库文件提示,则需要进一步排查和修复。 --- #### 自动化工具推荐 为了简化依赖管理过程,建议使用 `yum` 或者 `dnf` 工具代替纯手工的 `rpm -ivh` 方法。例如: ```bash yum install postgresql14-libs ``` 这种方式能够自动解析并安装所需的所有依赖项。 --- ### 注意事项 - 确保操作系统架构与目标 RPM 文件一致(此处为 RHEL 7 和 x86_64 架构)。 - 若计划部署完整的 PostgreSQL 数据库服务器而非仅仅安装共享库,请一并考虑其他组件(如 server、contrib 等模块)以及初始化配置流程[^4]。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值