Gitlab – create and restore backup

To create backup enter command:

sudo gitlab-rake gitlab:backup:create

First we need to make sure that the backup tar file is in the backup directory described in the gitlab.rb configuration (Default is /var/opt/gitlab/backups). Next, we need gitlab running for restoring backup on ominbus installations. If itโ€™s not up, start with,

sudo gitlab-ctl start

and we need to have services that are connected to database in stopped state,

sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq

Copy files from backup folder (/var/opt/gitlab/backups) to external hard drive, also copy files:

/etc/gitlab/gitlab-secrets.json
/etc/gitlab/gitlab.rb

Now execute the following command to restore the backup on server,

sudo gitlab-rake gitlab:backup:restore BACKUP=1393157476_2018_03_11_9.1.0

here, 1393157476_2018_03_11_9.1.0 is the name of the backup file that will be restored. Once the backup has been restored, we need to restart the gitlab services,

sudo gitlab-ctl restart

We now have successfully restored gitlab from the backup file.

One thought on “Gitlab – create and restore backup”

Comments are closed.