How To Change the Default Backup Location of GitLab on Linux Mint 20

To change the default backup location of GitLab on Linux Mint 20

Introduction:

GitLab is a free and self-hosted web-based repository manager. It is used to create and edit new projects, merge finished code into the existing projects, and also to serve as an inter-mediator between the server and user. The following tutorial will explain about how to change the default backup location of GitLab.

Installation procedure:

Check the version of the OS by triggering the below command:

root@linuxhelp:~# cat /etc/os-release 
NAME="Linux Mint"
VERSION="20 (Ulyana)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20"
VERSION_ID="20"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=ulyana
UBUNTU_CODENAME=focal

Now, create a directory in a location before configuring a GitLab file:

root@linuxhelp:~# mkdir /mnt/new-gitlab
root@linuxhelp:~# vi /etc/gitlab/gitlab.rb

Once the configuration is completed, reconfigure the GitLab service by using the below command:

root@linuxhelp:~# gitlab-ctl reconfigure
Starting Chef Infra Client, version 15.12.22
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
Running handlers complete
Chef Infra Client finished, 6/776 resources updated in 01 minutes 48 seconds
Warnings:
Environment variable LANG specifies a non-UTF-8 locale. GitLab requires UTF-8 encoding to function properly. Please check your locale settings.
gitlab Reconfigured!

After GitLab service reconfiguration is completed, create a GitLab backup:

root@linuxhelp:~# gitlab-rake gitlab:backup:create
2020-11-13 13:49:19 +0530 -- Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2020-11-13 13:49:28 +0530 -- done
2020-11-13 13:49:28 +0530 -- Dumping repositories ...
.
.
.
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
Deleting old backups ... skipping
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data 
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.
Backup task is done.

Once the GitLab backup is completed, go to the location where the newly created GitLab backup file is stored

root@linuxhelp:~# cd /mnt/new-gitlab/
root@linuxhelp:/mnt/new-gitlab# ls -lt
total 220
-rw------- 1 git git 225280 Nov 13 13:49 1605255570_2020_11_13_13.4.6_gitlab_backup.tar

With this method, to change the backup location of the GitLab on Linux Mint 20 comes to an end.

FAQ
Q
What is the command to reconfigure the GitLab?
A
The command # gitlab-ctl reconfigure
Q
How to create a backup on GitLab?
A
The command to create a backup on gitlab is # gitlab-rake gitlab:backup:create
Q
Where do we change the backup location on the GitLab configuration file?
A
The location is # backup_path=(Location)
Q
What is the location of the GitLab configuration file?
A
The location is # /etc/gitlab/gitlab.rb
Q
What is the name of the GitLab configuration file?
A
The name of the GitLab configuration file is gitlab.rb