美文网首页
Centos7升级gitlab8到12

Centos7升级gitlab8到12

作者: 新网名 | 来源:发表于2019-12-05 13:42 被阅读0次

一、备份

1、查看当前版本

[root@git ~]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
8.17.2

2、备份

[root@git ~]# gitlab-rake gitlab:backup:create

默认会在/var/opt/gitlab/backups文件夹下生成备份文件:1575486969_2019_12_05_8.17.2_gitlab_backup.tar,注意此文件的权限为git:git,如果在转移复制过程中丢失权限:请执行:

chown git:git 1575486969_2019_12_05_8.17.2_gitlab_backup.tar

二、升级

注意:gitlab跨版本的升级必须是从当前大版本的最新版升级到下一个大版本,所以我们需要下载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

升级完成

三、设置备份至阿里云OSS(可选)

最新版支持备份数据自动上传到AWS或阿里云OSS:

[root@git ~]# vim /etc/gitlab/gitlab.rb
# 搜索关键字: backup_upload_connection,修改相关配置或在下面直接添加
 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'
# 保存关闭,并使设置生效
[root@git ~]# gitlab-ctl reconfigure

到此,每次执行备份命令: gitlab-rake gitlab:backup:create 时,gitlab会在备份完成后自动上传备份文件到OSS,你可以设置一个linux定时任务,每天执行一次备份命令。

四、遇到的问题

1、升级后出现一直提示Deploy in progress
执行命令:

[root@git ~]# gitlab-ctl deploy-page down

相关文章

网友评论

      本文标题:Centos7升级gitlab8到12

      本文链接:https://www.haomeiwen.com/subject/pwldgctx.html