Gitlab Backup and Restore
Backup
Find the backup directory:
grep backup_path /etc/gitlab/gitlab.rb
Issue backup:
sudo gitlab-backup create
Transfer backup using scp to destination machine.
Backup configuration and secrets:
sudp cp /etc/gitlab/gitlab-secrets.json /backuppath/
sudo cp /etc/gitlab/gitlab.rb /backuppath/
Restore
See also here: https://docs.gitlab.com/ee/administration/backup_restore/restore_gitlab.html
DO NOT OVERWRITE THE CONFIGURATION ON THE DESTINATION MACHINE. COMPARE IT AND CONSIDER AND EVALUATE EACH DIFFERENCE
Stop processes of GitLab connecting to the database:
gitlab-ctl stop puma
gitlab-ctl stop sidekiq
# check
gitlab-ctl status
Do not stop the whole system since the restore tool has to connect to the database which would also stop in that case.
Issue restore. Run this command in a screen session. It is running quite long and requires manual intervention in between.
sudo gitlab-backup restore BACKUP=...
Use the datecode and the version tag of the backup created above.
Remember secrets and configuration. Do not overwrite configuration, see above.
Reconfigure the instance:
sudo gitlab-ctl reconfigure
Start the instance:
sudo gitlab-ctl start