默认的备份地址
/var/opt/gitlab/backups
基于宝塔的操作
将原本服务器的备份选择外链分享,然后在新的服务器上选择从外链下载
1。创建备份
sudo gitlab-rake gitlab:backup:create
迁移到/var/opt/gitlab/backups文件夹下
2。停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
3。恢复备份
gitlab-rake gitlab:backup:restore BACKUP=备份文件编号
4。恢复完成后,启动gitlab
gitlab-ctl reconfigure
gitlab-ctl start
错误:timeout: down: nginx: 1s, normally up, want up
vim /opt/gitlab/sv/nginx/run
#exec chpst -P /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
exec chpst -P /opt/gitlab/embedded/sbin/gitlab-web -p /var/opt/gitlab/nginx
OpenSSL::Cipher::CipherError (bad decrypt): app/models/project.rb:383:in `im
gitlab打开项目页报错500,之前做过迁移,官方说法是数据恢复时的bug,没有恢复config/secrets.yml文件,只需要把原文件覆盖过来就可以了
Processing by ProjectsController#show as HTML Parameters: {“namespace_id”=>“lsq”, “id”=>“djbbs”} Completed 500 Internal Server Error in 39ms (ActiveRecord: 2.0ms)
gitlab-rails runner "Project.where.not(import_url: nil).each { |p| p.import_data.destroy if p.import_data }"
迁移clone
vim /var/opt/gitlab/gitlab-rails/etc/gitlab.yml #打开配置文件,参考图修改后重启
gitlab-ctl restart # 重起生效 #
设置自动备份和自动清理
修改配置文件
vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/data/gitlab_backup"
# gitlab_rails['backup_archive_permissions'] = 0644 # See: http://doc.gitlab.com/ce/raketasks/backup_restore.html#backup-archive-permissions
# gitlab_rails['backup_pg_schema'] = 'public'
gitlab_rails['backup_keep_time'] = 259200
重启配置
gitlab-ctl reconfigure
修改gitlab克隆地址
vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
重启生效
gitlab-ctl restart