一、備份
1、查看當(dāng)前版本
[root@git ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
8.17.2
2、備份
[root@git ~]# gitlab-rake gitlab:backup:create
默認(rèn)會在/var/opt/gitlab/backups文件夾下生成備份文件:1575486969_2019_12_05_8.17.2_gitlab_backup.tar,注意此文件的權(quán)限為git:git,如果在轉(zhuǎn)移復(fù)制過程中丟失權(quán)限:請執(zhí)行:
chown git:git 1575486969_2019_12_05_8.17.2_gitlab_backup.tar
二、升級
注意:gitlab跨版本的升級必須是從當(dāng)前大版本的最新版升級到下一個大版本,所以我們需要下載8-12所有版本的最新版
1、下載所有大版本號下最新版的rpm文件
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.17.8-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.8.7-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.11.8-ce.0.el7.x86_64.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
2、按版本順序依次升級
yum localinstall -y gitlab-ce-8.17.8-ce.0.el7.x86_64.rpm
yum localinstall -y gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm
yum localinstall -y gitlab-ce-10.8.7-ce.0.el7.x86_64.rpm
yum localinstall -y gitlab-ce-11.11.8-ce.0.el7.x86_64.rpm
yum localinstall -y gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
3、再次查看版本
[root@git ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
12.5.0
升級完成
三、設(shè)置備份至阿里云OSS(可選)
最新版支持備份數(shù)據(jù)自動上傳到AWS或阿里云OSS:
[root@git ~]# vim /etc/gitlab/gitlab.rb
# 搜索關(guān)鍵字: backup_upload_connection,修改相關(guān)配置或在下面直接添加
gitlab_rails['backup_upload_connection'] = {
'provider' => 'aliyun',
'aliyun_accesskey_id' => '[阿里云的keyid]',
'aliyun_accesskey_secret' => '[阿里云的secret]',
'aliyun_oss_endpoint' => 'http://oss-cn-beijing.aliyuncs.com',
'aliyun_oss_bucket' => 'gitlab-bakup',
'aliyun_oss_location' => 'beijing'
}
gitlab_rails['backup_upload_remote_directory'] = 'gitlab'
# 保存關(guān)閉,并使設(shè)置生效
[root@git ~]# gitlab-ctl reconfigure
到此,每次執(zhí)行備份命令: gitlab-rake gitlab:backup:create 時,gitlab會在備份完成后自動上傳備份文件到OSS,你可以設(shè)置一個linux定時任務(wù),每天執(zhí)行一次備份命令。
四、遇到的問題
1、升級后出現(xiàn)一直提示Deploy in progress
執(zhí)行命令:
[root@git ~]# gitlab-ctl deploy-page down