How to change default backup location in GitLab

How to change default backup location in GitLab

GitLab is a web based project management repository based on Git. It lets you to create and manage your projects effectively. As a part of our GitLab series, this tutorial will explain on how to change default backup location in GitLab.

Configuration procedure

To start the installation procedure, first create a new directory at any location.

[root@localhost ~]# mkdir /mnt/new-gitlab

Open the GitLab configuration file and remove the default storage location and add the new location in the configuration file and save it.

[root@localhost ~]# vim /etc/gitlab/gitlab.rb
gitlab_rails[' backup_path' ] = " /mnt/new-gitlab" 

Reconfigure the gitlab service by executing the following command.

[root@localhost ~]# gitlab-ctl reconfigure
Starting Chef Client, version 12.12.15
resolving cookbooks for run list: [" gitlab" ]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - package (0.0.0)
  - runit (0.14.2)
.
.
.
Running handlers:
Running handlers complete
Chef Client finished, 10/392 resources updated in 01 minutes 21 seconds
gitlab Reconfigured!

Now create a backup by executing the following command. The backup gets created successfully,

[root@localhost ~]# gitlab-rake gitlab:backup:create
Dumping database ..
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * server-group/linuxhelp ... [SKIPPED]
 * server-group/linuxhelp.wiki ...  [SKIPPED]
.
.
.
done
done
Deleting old backups ... skipping

Go to the newly created GitLab backup location by using the cd command and the location of the new backup.

[root@localhost ~]# cd /mnt/new-gitlab/

Now list the directory, the backup file is created under the newly configured location successfully.

[root@localhost new-gitlab]# ls -l
total 52
-rw------- 1 git git 51200 Apr 13 19:00 1492090251_2017_04_13_gitlab_backup.tar

Wasn' t it a simple procedure? Now creating a backup and to change the default backup location in gitlab is easy with a few steps.

Tag : gitlab
FAQ
Q
Does GitLab provide a way to block project creation for certain users?
A
GitLab admins can set a project limit for each user. If the limit is set to 0 the user cannot create any projects.
Q
Does GitLab support groups of users?
A
GitLab does support user groups which allow you to group projects into directories and give users access to several projects at once.
Q
What is GitLab?
A
GitLab is a web-based project management repository based on Git. It lets you create and manage your projects effectively.
Q
where is Default Backup Location In GitLab?
A
Default Backup Location In GitLab is available in /var/opt/gitlab/backups.
Q
I get " cannot find repo " after changing my changing my default backup path. in Gitlab what can I do?
A
Please execute to find the backup path in Gitlab
# gitlab-rake cache:clear RAILS_ENV=production
and then check again