How to restore the GitLab server?

From PheonixSolutions
Jump to navigation Jump to search

Step 1: Login to server

Step 2: Copy the latest backup file from S3 to server

 aws s3 cp s3://git-pheonixsolutions-server/1645425034_2022_02_21_13.12.15_gitlab_backup.tar .

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

cp 1645425034_2022_02_21_13.12.15_gitlab_backup.tar /var/opt/gitlab/backups

Step 4: Untar the backup file in the backups folder

tar -xvf 1645425034_2022_02_21_13.12.15_gitlab_backup.tar .

Step 5: Install Gitlab

Check the version in gitlab and make sure to install the same.

 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce /script.deb.sh | sudo bash
 sudo apt-get install gitlab-ce=13.12.15-ce.0

Step 6: Stop the process which are related to database:

 gitlab-ctl stop unicorn
 gitlab-ctl stop sidekiq
 gitlab-ctl stop grafana
 gitlab-ctl stop Prometheus

Step 7: Verify the status of gitlab

sudo gitlab-ctl status

Step 8: Now, restore the backup

 gitlab-backup restore BACKUP=1645425034_2022_02_21_13.12.15

Step 9:Modify the file -/etc/gitlab/gitlab.rb

And also make sure to enable the webserver

Step 10: sudo gitlab-ctl reconfigure

Whenever we are making changes in the gitlab.rb file make sure to reconfigure.

Step 11 – Restart the gitlab

 gitlab-ctl restart

Step 12: Now check the GitLab by sanitizing the database as shown below

 gitlab-rake gitlab:check SANITIZE = true

Ref link: GitLab - Restore Backup (tutorialspoint.com)