gitlab从8.6.5升级到8.11.7(补丁版本通用更新指南)

环境介绍:
CentOS 6.8 final
gitlab:8.6.5
需求:gitlab从8.6.5升级到8.11.7

第一、gitlab8.6.5安装

参考《GitLab完整搭建(8.6.5).docx》

第二、gitlab8.6.5升级到8.11.7

0.升级之前Backup备份

# su - git
$ cd /home/git/gitlab
$ bundle exec rake gitlab:backup:create RAILS_ENV=production

备份的文件在/home/git/gitlab/tmp/backups目录下:
备份的文件

1.停止服务

# service gitlab stop

2.获取最新版本分支代码

$ su - git
$ cd /home/git/gitlab
$ git fetch --all 

git fetch

$ git checkout -- Gemfile.lock db/schema.rb
$ git checkout v8.11.7 -b v8.11.7

如果报错,删除修改过的文件
删除错误文件

git checkout
$ vi VERSION
将8.6.5替换为8.11.7

3.升级gitlab-shell版本

$ cd /home/git/gitlab-shell
$ git fetch

git fetch

$ git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION` -b v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`

git checkout

4.升级gitlab-workhorse版本

$ cd /home/git/gitlab-workhorse
$ git fetch

git fetch

$ git checkout v`cat /home/git/gitlab/GITLAB_WORKHORSE_VERSION` -b v`cat /home/git/gitlab/GITLAB_WORKHORSE_VERSION`

git checkout

$ make

make

5. 安装库环境

$ cd /home/git/gitlab
修改Gem source
$ gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
# PostgreSQL
    $bundle install --without development test mysql --deployment
# MySQL
    $bundle install --without development test postgres --deployment

安装库环境

# Optional: clean up old gems
    $bundle clean
# Run database migrations
    $bundle exec rake db:migrate RAILS_ENV=production

Run database migrations

# Clean up assets and cache
    $bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production

Clean up assets and cache

6.启动gitlab服务

# service gitlab start
# service nginx restart

启动gitlab服务

7.检查程序状态

检查GitLab及其环境是否配置正确:
$ bundle exec rake gitlab:env:info RAILS_ENV=production
确保没有报错,运行一次更彻底的检查:
$bundle exec rake gitlab:check RAILS_ENV=production
如果所有项目是绿色的,那么恭喜你升级完成!
gitlab从8.6.5升级到8.11.7到此结束。

第三、备份数据迁移

1.备份

1).备份mysql数据库

$ mysqldump -uroot -pxxxx gitlabhq_production > /tmp/gitlabhq_production.sql

2).备份keys

$ cp /home/git/.ssh/authorized_keys /tmp/authorized_keys

3).备份repos

$ cd /home/git/gitlab
$ bundle exec rake gitlab:backup:create RAILS_ENV=production

备份的文件在/home/git/gitlab/tmp/backups目录下

2.恢复数据

1). 导入仓库,检查权限

$cd /home/git
$tar zxvf repositories.tar.gz

如果权限有异常,直接重新赋权
$ chown -R git.git /home/git/repositories/

2).导入数据库

$ mysql -uroot -pxxx gitlabhq_production < gitlabhq_production.sql

3).导入keys

$ cat authorized_keys >> /home/git/.ssh/authorized_keys

4).导入repos

$ cd /home/git/gitlab/
$ bundle exec rake gitlab:import:repos RAILS_ENV=production
$ bundle exec rake gitlab:satellites:create RAILS_ENV=production

5).检测

$ bundle exec rake gitlab:check RAILS_ENV=production
如果检测没有异常,可以重启gitlab服务
# /etc/init.d/gitlab restart

第四、验证git pull/push与异常解决

1. git pull

git pull

2. git push

git push

如果报错:

git.exe push –progress “origin” master:master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 350 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: An unexpected error occurred (redis-cli returned 1).
remote: error: hook declined to update refs/heads/master
To http://192.168.3.124/caoyang/test1121.git
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to ‘http://192.168.4.251/caoyang/test1121.git

屏蔽 /home/git/gitlab-shell/config.yml 47行redis配置
redis配置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

曹宇飞丶

您的鼓励是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值