记一次gitlab版本升级,以及升级中出现的错误

由于业务情况,需要升级gitlab版本测试一个功能。

1.升级路线

gitlab升级不能一步到位,要一个个版本渐进式升级,根据官方文档选择自己的升级路线。

官方文档:https://docs.gitlab.com/ee/update/index.html#upgrade-paths

根据文档,升级路线为:11.4.3 -> 11.11.8 -> 12.0.12 -> 12.1.17 -> 12.10.14 -> 13.0.14 -> 13.1.11 -> 13.8.8 -> 13.12.15 -> 14.0.12 -> 14.3.6 -> 14.6.2 -> 14.9.5 -> 14.10.5

本次gitlab版本升级为,13.8.8 -> 13.12.15 -> 14.0.12 -> 14.3.6

2.升级前期准备。(主要就是备份相关数据和配置文件)

gitlab-rake gitlab:backup:create

cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.bak

3.下载gitlab安装包

​
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yumm/el7/gitlab-ce-13.12.15-ce.0.el7.x86_64.rpm --no-checkcertificate

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yumm/el7/gitlab-ce-14.0.12-ce.0.el7.x86_64.rpm --no-check-certificate

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.3.6-ce.0.el7.x86_64.rpm --no-check-certificate

​

4.暂停gitlab中的3个服务,依次安装<3>中的安装包。每次安装完成必须要执行gitlab-ctl reconfigure && gitlab-ctl restart,并且登陆web查看服务

gitlab-ctl stop unicorn sidekiq puma

yum install -у --setopt=obsoletes=0 gitlab-ce-14.3.6-ce.0.el17.x86_64.rpm

gitlab-ctl reconfigure && gitlab-ctl restart

yum install -y --setopt=obsoletes=0 gitlab-ce-14.3.6-ce.0.el7.x86 64.rpm

gitlab-ctl reconfigure && gitlab-ctl restart

yum install -y --setopt=obsoletes=0 gitlab-ce-14.3.6-ce.0.el7.x86_64.rpm

gitlab-ctl reconfigure && gitlab-ctl restart

5.报错信息

在 13.12.15升级到14.0.12时报错,信息如下

如果遇到此类报错,一定要仔细查看报错原因。以上图中的报错原因为:在14版本中已经不用unicorn,repmgr的服务了。因此在/etc/gitlab/gitlab.rb中的一些配置需要更换成puma,或者先注释掉。

建议先注释掉,后续升级完成后,再进行配置。

将以上的注释掉,再次安装即可。

在14.0.12 升级到14.3.6 时,gitlab-ctl reconfigure报错,信息如下

Running handlers:

There was an error running gitlab-ctl reconfigure:

rails_migration[gitlab-rails] (gitlab: database_migrations line51) had an error: Mixlib::Shellout: ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) hadan error: Mixlib::Shellout::ShellCommandFailed: Expected proces

"to exit with [0], but received"

---- Begin output of "bash" "htmp/chef-script20231107-30629-laf95ja" ----

STDOUT: rake aborted!

StandardÉrror: An error has occurred, all later migrations canoeled

Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':

Finalize it manualy by running

{:job_class_name=>"CopyColumnUsingBackgroundMigrationjob", :tabole_name=>"ci_builds metadata", :column_name=>"іd", :job_argumennts=>{{"id"], ["id_convert_to bigint"]}}

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id, "["id"]\'["id_convert_to bigint"]]']

此报错原因是在reconfigure时,出现了构建上的报错。

解决方法如下:

a.先停掉gitlab服务,启动 postgresql服务。然后运行报错信息中的命令,然后运行gitlab-rake db:migrate

gitlab-ctl stop

gitlab-ctl start postgresql

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id, "["id"]\'["id_convert_to bigint"]]']

gitlab-rake db:migrate

再次gitlab-ctl reconfigure ,成功初始化。

注:

gitlab-rake db:migrate --trace  可以查看错误详细信息

gitlab-rake db:migrate:status可以查看状态

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值