Friday, 22 December 2017

Gitlab backup and restore - Simple way

We can easily  take a backup and restore data from gitlab.

Step 1

Taking backup from gitlab

First we need to use the below mentioned command to take a backup.

gitlab-rake gitlab:backup:create

Holding time will depends on your gitlab project size.

If we need skip some files from taking backup then issue the additional lines in that command

gitlab-rake gitlab:backup:create SKIP=db,uploads

it will skip the db and uploads.

Backup data will stored in the default location of gitlab /var/opt/gitlab/backups/ with timestamp and tar format. example

 1973754682_2017_12_22_gitlab_backup.tar

Step 2

Restoring the gitlab data

before starting restore command we have to stop 2 services from gitlab.

gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

Verify once the status of these services were stoped or not with below command.

gitlab-ctl status

now run the below command to restore.

gitlab-rake gitlab:backup:restore  BACKUP=1973754682_2017_12_22

Now it will ask like screen shot below. Type yes to continue.





then again it will ask question like below screenshot, then typ yes.



that's all it will complete within few min or seconds. 

Now start the services of gitlab with below command.

gitlab-ctl start

now we need to check the gitlab status after restore with below command.

gitlab-rake gitlab:check SANITIZE=true

it will take some time to check after complete the check verify it. 

Now login and check.

That's all......




Permanent hostname setup for RHEL7

Step 1 Set the host name on NMTUI tool like following nmtui set host name   then save and exit Step 2 add the following l...