Gitlab 升级、备份与恢复

1.Gitlab的 rpm 包下载(下载到/usr/local/src)

wget https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-10.5.2-ce.0.el6.x86_64.rpm

2.Gitlab数据备份

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
gitlab-rake gitlab:backup:create
ls /var/opt/gitlab/backup #备份位置

3.Gitlab升级过程

注意:gitlab 升级前必须进行数据备份操作
rpm -Uvh gitlab-ce-10.5.2-ce.0.el6.x86_64.rpm
gitlab-ctl reconfigure
gitlab-ctl restart [nginx]

4.Gitlab 版本信息

# head -1 /opt/gitlab/version-manifest.txt

5.Gitlab 恢复

required: linux系统版本一致,gitlab 版本一致
(1)  Prepare:
    yum install -y curl policycoreutils-python openssh-server cronie
    yum install postfix && service postfix start && chkconfig postfix on
(2) Install:
    rpm -ivh gitlab-ce-10.5.2-ce.0.el6.x86_64.rpm
(3) Postpare:
gitlab-ctl reconfigure # 重置或生成新的数据目录/var/opt/gitlab
gitlab-ctl  restart 
(4) 数据还原
Next, restore /etc/gitlab/gitlab-secrets.json  and  /etc/gitlab/gitlab.rb if necessary as mentioned above. 
Next, restore /var/opt/gitlab/.ssh to new machine’s direct
将备份的数据copy至新机器
scp 1493107454_2017_04_25_9.1.0_gitlab_backup.tar 192.168.99.116:`pwd`
chown git.git /var/opt/gitlab/backups/*.tar
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore  BACKUP=1493107454_2017_04_25_9.1.0
gitlab-ctl restart
gitlab-rake gitlab:check SANITIZE=true

6.Gitlab 邮件发送访问路径及部分logo加载问题

scp /etc/gitlab/gitlab.rb   192.168.99.116: /etc/gitlab/gitlab.rb
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
gitlab-ctl reconfigure
gitlab-ctl restart

相关推荐