GitLab - Restore Backup


Advertisements

GitLab allows restoring the backup copy of your repository. In this chapter, we will discuss about how to restore the backup copy in the GitLab −

Step 1 − First, login to your GitLab server using SSH (Secure Shell).

Step 2 − Before restoring the backup copy, first make sure backup copy is in the /var/opt/gitlab/backups directory.

Step 3 − You can check the backup copy by using the ls -l command which is described in the Create Backup job chapter.

Step 4 − Now, stop the processes which are related to the database by using the below commands −

sudo gitlab-ctl stop unicorn

sudo gitlab-ctl stop sidekiq
GitLab Restore Backup

The above commands can also be used to free up some memory temporarily by shutting down them.

Step 5 − You can verify status of the GitLab services by using the below command −

sudo gitlab-ctl status

Step 6 − Now, restore the backup by using the timestamp of the backup copy −

sudo gitlab-rake gitlab:backup:restore BACKUP = 1521884424_2018_03_24_10.5.3
GitLab Restore Backup

Step 7 − Restart the GitLab components by using the below command −

sudo gitlab-ctl restart
GitLab Restore Backup

Step 8 − Now check the GitLab by sanitizing the database as shown below −

sudo gitlab-rake gitlab:check SANITIZE = true
GitLab Restore Backup

The SANITIZE = true flag removes all email addresses because they are confidential, removes the CI variables and access tokens as they can be used in the production instance.

Advertisements