gitlab升级

查看当前版本

sh 复制代码
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

12.9.3-ee

备份数据

sh 复制代码
gitlab-rake gitlab:backup:create

备份默认位置在 /var/opt/gitlab/backups/

备份配置数据(git配置目录)

sh 复制代码
tar -zcvf gitlab12.9.3-ee.tar.gz /etc/gitlab

备份数据文件(git数据目录)

sh 复制代码
tar -zcvf git-data12.9.3-ee.tar.gz /var/opt/gitlab/git-data

将以上三个文件下载或备份到其它服务器

配置yum源

sh 复制代码
cd /etc/yum.repos.d/
vi gitlab-ee.repo
sh 复制代码
[gitlab-ee]
name=gitlab-ee
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/
Repo_gpgcheck=0
Enabled=1
Gpgkey=https://packages.gitlab.com/gpg.key

重建yum缓存

sh 复制代码
yum makecache

确定升级路径

参考

https://docs.gitlab.com/ee/update/?tab=Self-compiled+(source)#version-specific-upgrading-instructions

https://archives.docs.gitlab.com/15.11/ee/update/#upgrade-paths

由此可以确定,我们的升级路径应该是

12.9.3-ee > 12.10.14 >13.0.14 > 13.1.11 > 13.8.8 > 13.12.15 > 14.0.12 > 14.3.6 > 14.9.5 > 14.10.5 >15.0.5 > 15.1.6 (for GitLab instances with multiple web nodes) > 15.4.6 > 15.11.13 > 16.0.8 (only instances with lots of users or large pipeline variables history) > 16.1.6 (instances with NPM packages in their package registry) > 16.2.9 (only instances with large pipeline variables history) > 16.3.7 > 16.7.6 > latest 16.9.1

这里的16.7.6和16.9.1是根据仓库(https://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7/)中的最新小版本确定的

升级至12.10.14

升级到12.10.14 不必全部停止(升级中可能会用到其它服务)

停止gitlab相关服务

sh 复制代码
gitlab-ctl stop nginx
gitlab-ctl stop sidekiq
gitlab-ctl stop unicorn

安装12.10.9版本

sh 复制代码
yum --showduplicates list gitlab-ee   # 查看yum可用安装包

yum -y install gitlab-ee-12.10.14-ee.0.el7  --nogpgcheck

升级完成后,重新加载配置文件并重启

sh 复制代码
gitlab-ctl reconfigure
gitlab-ctl restart

验证

打开git网址或通过gitlab-ctl tail gitlab-rails查看日志

如果上面的升级没有问题,接下来重复上述步骤按照升级路径依次升级

13.12.15版本升级14.0.12版本需要先执行以下操作

14版本更新后将unicorn替换为puma

sh 复制代码
vim /etc/gitlab/gitlab.rb 
:%s/unicorn/puma/g

重新加载配置文件

sh 复制代码
gitlab-ctl reconfigure

配置完成后可以看到如下提示

这里要根据提示重启postgresql

sh 复制代码
gitlab-ctl restart postgresql

这里还需要注意14版本建议的redis版本为6.x,如果redis版本较低,在这里也要升级redis。

centos可以参考centos使用yum安装redis最新版CentOS 7安装redis6.2.6。如果有重要数据记得备份

如果在执行gitlab-ctl reconfigure时遇到错误,按照错误提示处理即可,我这里有遇到

sh 复制代码
sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_job_artifacts,id,'[["id"\, "job_id"]\, ["id_convert_to_bigint"\, "job_id_convert_to_bigint"]]']

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

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,taggings,id,'[["id"\, "taggable_id"]\, ["id_convert_to_bigint"\, "taggable_id_convert_to_bigint"]]']

按照提示执行即可

检查是否有执行中的迁移

sudo gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'

如果结果显示为0,则可以继续升级

参考文章
gitlab-ce 大版本升级方式 | 13.xx.xx升级到14.xx.xx注意事项
gitlab 14.4.2升级至15.11.2报错修复
gitlab升级12.2.8版本至14.9.2版本
gitlab 日志查看
关闭gitlab中的prometheus

相关推荐
Echoo华地8 小时前
GitLab升级后仓库镜像信任证书导入问题
证书·gitlab·trust store·certificate·信任库·仓库镜像
一念一花一世界15 小时前
DevOps实战(4) - 使用Arbess+GitLab+SourceFare实现Java项目自动化部署
gitlab·tiklab·arbess·开源cicd工具·sourcefare
赵孝正16 小时前
GitLab 分支管理与 Push 问题全解析
大数据·elasticsearch·gitlab
wjs0401 天前
Git常用的命令
java·git·gitlab
至善迎风1 天前
版本管理系统与平台(权威资料核对、深入解析、行业选型与国产平台补充)
git·gitee·gitlab·github·svm
高旭的旭1 天前
Gitlab 配置自定义 clone 地址
svn·ssh·gitlab·code
一念一花一世界1 天前
DevOps实战(3) - 使用Arbess+GitLab+Hadess实现Java项目自动化部署
gitlab·jenkins·tiklab·arbess·开源cicd工具
faimi3 天前
🚀程序员必收藏!最全Git命令手册:解决90%团队协作难题
前端·gitlab
rivercoder3 天前
Gitea:轻量级的自托管Git服务
git·gitlab·gitea
运维开发王义杰4 天前
信息安全:GitLab与AWS OIDC集成的深度解析,IAM信任策略中的条件配置
云计算·gitlab·aws