0%

GitLab 版本升级测试

GitLab 版本升级测试

生产环境的 GitLab 版本比较老,计划升级到最新版本,以下为测试步骤。

操作系统版本:CentOS 6.7 x86_64

GitLab 版本:7.14.1 升级到 8.17.3

安装 GitLab 7.14.1

关闭 selinux 和 iptables 。

1
2
3
setenforce 0
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config
chkconfig iptables off

添加 163 YUM 源 。

1
2
3
4
5
rename .repo .bak /etc/yum.repos.d/*.repo
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
sed -i 's@^exclude@#exclude@' /etc/yum.conf
yum clean all
yum makecache

安装 GitLab 所需依赖。

1
2
3
yum install curl openssh-server openssh-clients postfix cronie
service postfix start
chkconfig postfix on

安装 GitLab 7.14.1。

1
rpm -ivh gitlab-ce-7.14.1-ce.0.el6.x86_64.rpm

导入 GitLab 数据

拷贝生产环境的 GitLab 备份到 /var/opt/gitlab/backups/ 目录。

1
1489612446_gitlab_backup.tar

还原 GitLab 数据。

1
2
3
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=1489612446

升级 GitLab 版本

因为 GitLab 官网下载速度慢,所以添加清华大学 GitLab 的 YUM 源 进行安装。

1
2
3
4
5
6
7
8
cat gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key

yum 更新缓存。

1
yum makecache fast

发现下载速度不够快,尝试更换 DNS 解决。

1
2
cat /etc/resolv.conf
nameserver 114.114.114.114

升级 GitLab 版本到 8.17.3 。

1
yum update gitlab-ce.x86_64

升级完成后,登录新版的 GitLab 进行测试,没有问题。