GitLab 如何降级?

本分分享 GitLab 降级的流程和注意事项。极狐GitLab 为 GitLab 的中文发行版,本文以私有化部署的极狐GitLab 为例来演示整个过程。

【极狐GitLab 推出 GitLab 老旧版本的专业升级服务https://dl.gitlab.cn/cm33bsfv】,可以让 12.x、13.x、14.x、15.x 等老旧版本的升级平滑不出问题】

首先确定当前的版本信息,在实例 URL 后面加 /help就可以查看:

当前实例为 17.5.1-jh。我们降级到 17.4.0-jh。

降级之前需要做好备份,执行 gitlab-backup create即可开始备份。

复制代码
# 开始备份
gitlab-backup create
2024-11-13 04:43:09 UTC -- Dumping database ...
2024-11-13 04:43:09 UTC -- Dumping PostgreSQL database gitlabhq_production ...
2024-11-13 04:43:44 UTC -- [DONE]
2024-11-13 04:43:44 UTC -- Dumping database ... done
2024-11-13 04:43:44 UTC -- Dumping repositories ...
{"command":"create","gl_project_path":"devsecops.wiki","level":"info","msg":"started create","pid":321034,"relative_path":"@groups/4f/c8/4fc82b26aecb47d2868c4efbe3581732a3e7cbcc6c2efb32062c08170a05eeb8.wiki.git","storage_name":"default","time":"2024-11-13T04:43:45.332Z"}
......太长删除......
Please back them up manually.
2024-11-13 04:43:46 UTC -- Backup 1731472989_2024_11_13_17.5.1-jh is done.
2024-11-13 04:43:46 UTC -- Deleting backup and restore PID file at [/opt/gitlab/embedded/service/gitlab-rails/tmp/backup_restore.pid] ... done

# 查看备份
ls -ltr /var/opt/gitlab/backups/
-rw------- 1 git git 379535360 Nov 13 04:43 /var/opt/gitlab/backups/1731472989_2024_11_13_17.5.1-jh_gitlab_backup.tar

接着执行降级的步骤,大体为:

  • 停止极狐GitLab
  • 移除当前的软件包
  • 安装降级之后的安装包
  • 重新配置极狐GitLab
  • 恢复备份
  • 启动极狐GitLab

下面我们一步步演示在 ubuntu 22.04 上如何降级安装好的极狐GitLab 实例。

整体步骤

停止极狐GitLab

复制代码
# If running Puma
sudo gitlab-ctl stop puma

# Stop sidekiq
sudo gitlab-ctl stop sidekiq

移除当前的安装包

复制代码
# If on Ubuntu: remove the current package
sudo dpkg -r gitlab-jh

安装降级之后的安装包

可以执行 apt-cache madison gitlab-jh找到需要降级的对应安装包信息。本文选择降级到 17.4.0-jh.0

接着执行安装命令进行低版本极狐GitLab 的安装:

复制代码
apt install gitlab-jh=17.4.0-jh.0

安装成功会显示如下界面:

重新配置极狐GitLab

执行 reconfigure命令重新配置极狐GitLab

复制代码
# 重新配置实例
gitlab-ctl reconfigure

# 查看组件状态
gitlab-ctl status
run: alertmanager: (pid 323277) 151s; run: log: (pid 323259) 152s
run: gitaly: (pid 323275) 151s; run: log: (pid 323261) 152s
run: gitlab-exporter: (pid 323274) 151s; run: log: (pid 323270) 151s
run: gitlab-kas: (pid 323237) 152s; run: log: (pid 323217) 152s
run: gitlab-workhorse: (pid 323238) 152s; run: log: (pid 323218) 152s
run: logrotate: (pid 323314) 151s; run: log: (pid 323260) 152s
run: nginx: (pid 323315) 151s; run: log: (pid 323263) 152s
run: node-exporter: (pid 323258) 152s; run: log: (pid 323256) 152s
run: postgres-exporter: (pid 323273) 151s; run: log: (pid 323271) 151s
run: postgresql: (pid 323264) 152s; run: log: (pid 323257) 152s
run: prometheus: (pid 323272) 151s; run: log: (pid 323254) 152s
run: puma: (pid 323220) 152s; run: log: (pid 323219) 152s
run: redis: (pid 323223) 152s; run: log: (pid 323221) 152s
run: redis-exporter: (pid 323276) 151s; run: log: (pid 323262) 152s
run: sidekiq: (pid 323224) 152s; run: log: (pid 323222) 152s

恢复数据

复制代码
# 找到对应的备份文件,恢复数据
gitlab-backup restore BACKUP=1730349575_2024_10_31_17.4.0-jh
2024-11-13 06:09:17 UTC -- Unpacking backup ...
2024-11-13 06:09:18 UTC -- Unpacking backup ... done
2024-11-13 06:09:18 UTC -- Restoring database ...
2024-11-13 06:09:18 UTC -- Be sure to stop Puma, Sidekiq, and any other process that
connects to the database before proceeding. For Omnibus
installs, see the following link for more information:
http://jhma.jihulab.net/help/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations
......太长删除......
2024-11-13 06:13:09 UTC -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need to restore these files manually.
2024-11-13 06:13:09 UTC -- Restore task is done.
2024-11-13 06:13:09 UTC -- Deleting backup and restore PID file at [/opt/gitlab/embedded/service/gitlab-rails/tmp/backup_restore.pid] ... done

接着访问极狐GitLab 实例,查看对应的版本即可

注意事项

对于极狐GitLab 的降级操作一定是要慎之又慎,而且要确保做好了数据备份。如果在整个过程中出现问题,可以寻求极狐GitLab 专业升级服务https://dl.gitlab.cn/cm33bsfv】。

相关推荐
daemon.qiang8 小时前
国内虚拟机对接 Freedesktop:Fork xserver、自建 Runner 与提交 MR 实战
linux·ubuntu·centos·gitlab·开源软件
龙智DevSecOps解决方案11 小时前
JFrog供应链流量控制器架构解析:如何通过 SASE 集成阻断 AI 智能体的恶意依赖拉取?
ai编程·devops·jfrog·软件供应链安全
あ-13 小时前
proxmox控制台占用内存高虚拟机占用内存低排查
devops
龙智DevSecOps解决方案17 小时前
Perforce P4 2026 更新详解:P4 MCP 服务器、REST API、Spark Stream 与 P4 Signals
人工智能·devops·版本控制·p4·perforce
宋均浩19 小时前
告警规则 243 砍到 27:Prometheus 降噪实战,日均打扰 47 次 → 3 次
云原生·监控·devops
运维开发王义杰20 小时前
从失控到收敛:全栈生产安全 P1-P4 优先级落地指南
devsecops
智能运维指南1 天前
代码管理软件如何融入 DevOps 工具链?全链路联通的 5 个关键点
运维·devops·信创适配·嘉为蓝鲸
weixin_435247061 天前
DevOps成熟度评估与改进方案模版
devops
极小狐2 天前
CI 算力饥渴症:Runner 弹性伸缩的架构权衡与落地
ci/cd·kubernetes·devops·弹性伸缩
智能运维指南2 天前
持续集成平台怎么选?从Jenkins迁移、信创适配到质量门禁的全维评估
运维·devops·嘉为蓝鲸