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

相关推荐
Good_Starry1 天前
Git介绍--github/gitee/gitlab使用
git·gitee·gitlab·github
陌殇殇殇1 天前
使用GitLab CI构建持续集成案例
运维·ci/cd·云原生·容器·kubernetes·gitlab
吕玉生1 天前
基于GitLab 的持续集成环境
ci/cd·gitlab
henan程序媛3 天前
jenkins项目发布基础
运维·gitlab·ansible·jenkins
极小狐4 天前
极狐GitLab 签约比博斯特,助力新能源智能底盘企业研发提效
gitlab·devsecops·devops·极狐gitlab·安全合规
YoungHong19924 天前
Gitlab服务搭建相关
gitlab
sj11637394035 天前
docker-compose安装gitlab
docker·容器·gitlab
Matrix706 天前
GIT安装及集成到IDEA中操作步骤
java·git·spark·gitlab·intellij-idea
ulimpid8 天前
Git | Dockerized GitLab 安装使用(简单实操版)
学习·docker·gitlab
hrlees8 天前
从零开始Ubuntu24.04上Docker构建自动化部署(四)Docker安装gitlab
docker·自动化·gitlab