Gitlab备份、升级、恢复

一.备份
1.使用Omnibus安装包安装
--gitlab-rake gitlab:backup:create
2.使用源码安装
--./use_gitlab----如果备份失败,PATH路径错误,执行自带的环境变量设置脚本:use_gitlab
--bundle exec rake gitlab🔙create RAILS_ENV=production

备份文件会产生在config/gitlab.yml所指定的目录,如果未做指定默认存储在 /home/git/gitlab/tmp/backup下面
文件名格式[TIMESTAMP]_gitlab_backup.tar

二.恢复
1.安装包恢复方法:
将产生的文件传输到相同目录
--cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/
--gitlab-ctl stop unicorn
--gitlab-ctl stop sidekiq
--gitlab-rake gitlab:backup:restore BACKUP=1393513186
--gitlab-ctl start

2.源码安装恢复方法:
--bundle exec rake gitlab:backup:restore RAILS_ENV=production
小的版本号有差异也无法进行恢复

三.升级gitlab版本
A.使用Omnibus安装包安装的升级:
#1.安装升级软件包
#2.重新加载配置:
#hitlab-tl reconfigure
#3.重启服务:
#gitlab-ctl restart
#service gitlab stop

B.使用源码安装的升级:
#cd /etc/gitlab/gitlab
#git -H git fetch -all
#git -H git checkout --Gemfile.lock db/schema.rb
#git -H git checkout v8.14.3 -b v8.14.3

#cd /etc/gitlab/gitlab-shell
#git -H git fetch
#git -H git checkout v`cat /etc/gitlab/gitlab/GITLAB_SHELL_VERSION` -b v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`


#cd /etc/gitlab/gitlab-workhorse
#git -H git fetch
#git -H git checkout `cat /etc/gitlab/gitlab/GITLAB_WORKHORSE_VERSION` -b `cat /etc/gitlab/gitlab/GITLAB_WORKHORSE_VERSION`
#git -H make

#安装
#cd /etc/gitlab/gitlab

#git -H bundle install --without development test postgres --deployment
#git -H bundel install --without development test mysql --deploymet
#git -H bundle clean
#git -H bundle exec rake db:migrate RAILS_ENV=production
#git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production

#更新configuration文件
#git diff origin/8-5-stable:config/gitlab.yml.example origin/8-6-stable:config/gitlab.yml.example

#重新启动服务
#service gitlab start
#service nginx restart

#检查工作是否正常
#git -H bundle exec rake gitlab:env:info RAILS_ENV=production
posted @ 2017-04-28 10:37  --kasumi--  阅读(252)  评论(0编辑  收藏  举报