GitLab整體遷移

遷移說明

  • 舊gitlab環境地址:192.168.15.240
  • 新gitlab環境地址:192.168.15.241
  • 新舊環境的gitlab版本必須一致
  • Jenkins備份路徑:/var/opt/gitlab/backups/

1、備份舊gitlab(192.168.15.240)

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

2、複製舊gitlab備份文件到新gitlab(192.168.15.240)

[root@localhost ~]# scp /var/opt/gitlab/backups/1552914145_2019_03_18_11.4.5_gitlab_backup.tar [email protected]:/var/opt/gitlab/backups/

3、還原新gitlab(192.168.15.241)

[root@localhost ~]# gitlab-ctl stop unicorn
[root@localhost ~]# gitlab-ctl stop sidekiq
[root@localhost ~]# chmod -R 777 /var/opt/gitlab/backups
[root@localhost ~]# chmod -R 777 /opt/gitlab/embedded
[root@localhost ~]# cd /var/opt/gitlab/backups/
[root@localhost ~]# gitlab-rake gitlab:backup:restore BACKUP=1552914145_2019_03_18_11.4.5

如有提示,可收到處理一下文件:
restore handy:

[root@localhost ~]# cd /var/opt/gitlab/backups
[root@localhost backups]# tar xf uploads.tar.gz -C /var/opt/gitlab/gitlab-rails/uploads
[root@localhost backups]# tar xf builds.tar.gz -C /var/opt/gitlab/gitlab-ci/builds
[root@localhost backups]# tar xf pages.tar.gz -C /var/opt/gitlab/gitlab-rails/shared/pages
[root@localhost backups]# tar xf artifacts.tar.gz -C /var/opt/gitlab/gitlab-rails/shared/artifacts

以下命令對還原數據可靠性檢測

[root@localhost backups]# gitlab-ctl reconfigure
[root@localhost backups]# gitlab-ctl restart
[root@localhost backups]# gitlab-rake gitlab:check SANITIZE=true

4、附錄-注意事項

以下文件可能需要手動複製:
/var/opt/gitlab/.ssh/authorized_keys
/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb

/var/opt/gitlab/gitlab-rails/etc/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/premailer-rails-1.9.7/example/config/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/graphiql-rails-1.4.10/test/dummy/config/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/railties-4.2.10/lib/rails/generators/rails/app/templates/config/secrets.
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/graphql-1.8.1/spec/dummy/config/secrets.yml
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/hashie-forbidden_attributes-0.1.1/test/dummy/config/secrets.yml
/opt/gitlab/embedded/service/gitlab-rails/config/secrets.yml

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章