How to change default backup location in GitLab on Fedora 34

To Change Default Backup Location In GitLab on Fedora 34.

Introduction:

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.

Step 1: Check the OS version by using the below command

[root@linuxhelp ~]# cat /etc/os-release
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Step 2: Create the directory for GitLab backup by using the below command.

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

Step 3: To open the GitLab configuration file use the below problem.

 [root@linuxhelp ~]# vim /etc/gitlab/gitlab.rb

Step 4: To reconfigure the GitLab use the below command.

[root@linuxhelp ~]# gitlab-ctl reconfigure
Starting Chef Infra Client, version 15.17.4
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - package (0.1.0)
  - postgresql (0.1.0)
  - redis (0.1.0)
  - logrotate (0.1.0)
  - mattermost (0.1.0)
  - gitaly (0.1.0)
  - monitoring (0.1.0)
  - registry (0.1.0)
  - consul (0.1.0)
  - gitlab-kas (0.1.0)
  - praefect (0.1.0)
  - nginx (0.1.0)
  - gitlab-pages (0.1.0)
  - letsencrypt (0.1.0)
  - runit (5.1.3)
  - crond (0.1.0)
  - acme (4.1.3)
Installing Cookbook Gems:
    
Chef Infra Client finished, 6/771 resources updated in 01 minutes 58 seconds
gitlab Reconfigured!

Step 5: To take a backup from the GitLab use the below command

[root@linuxhelp ~]# gitlab-rake gitlab:backup:create
2021-11-17 05:27:36 +0530 -- Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
2021-11-17 05:27:52 +0530 -- done
2021-11-17 05:27:52 +0530 -- Dumping repositories ...
time="2021-11-16T23:57:53.834Z" level=info msg="started create" command=create gl_project_path=gitlab-instance-0ee6d82a/Monitoring relative_path=@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git storage_name=default
time="2021-11-16T23:57:54.626Z" level=warning msg="skipped create" command=create error="manager: repository empty: repository skipped" gl_project_path=gitlab-instance-0ee6d82a/Monitoring relative_path=@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.git storage_name=default
time="2021-11-16T23:57:54.627Z" level=info msg="started create" command=create gl_project_path=gitlab-instance-0ee6d82a/Monitoring.wiki relative_path=@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.wiki.git storage_name=default
time="2021-11-16T23:57:54.657Z" level=warning msg="skipped create" command=create error="manager: repository empty: repository skipped" gl_project_path=gitlab-instance-0ee6d82a/Monitoring.wiki relative_path=@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.wiki.git storage_name=default
time="2021-11-16T23:57:54.657Z" level=info msg="started create" command=create gl_project_path=gitlab-instance-0ee6d82a/Monitoring relative_path=@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.design.git storage_name=default
time="2021-11-16T23:57:54.659Z" level=warning msg="skipped create" command=create error="manager: repository empty: repository skipped" gl_project_path=gitlab-instance-0ee6d82a/Monitoring relative_path=@hashed/6b/86/6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b.design.git storage_name=default
2021-11-17 05:27:54 +0530 -- done
2021-11-17 05:27:54 +0530 -- Dumping uploads ... 
2021-11-17 05:27:54 +0530 -- done
2021-11-17 05:27:55 +0530 -- Dumping container registry images ... 
2021-11-17 05:27:55 +0530 -- [DISABLED]
Creating backup archive: 1637107075_2021_11_17_14.4.2_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
done
done
done
done
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.

Step 6: Use the below command to change the directory then use ls command to list the backup file.

 [root@linuxhelp ~]# cd /mnt/
 [root@linuxhelp mnt]# ls
hgfs  new-gitlab
[root@linuxhelp ~]# cd /mnt/new-gitlab/
 [root@linuxhelp new-gitlab]# ls
1637107075_2021_11_17_14.4.2_gitlab_backup.tar

**With this the process of GitLab backup on fedora 34 has come to an end**
FAQ
Q
How does GitLab backup work?
A
GitLab provides Rake tasks for backing up and restoring GitLab instances. An application data backup creates an archive file that contains the database,

all repositories, and all attachments. You can only restore a backup to exactly the same version and type (CE/EE) of GitLab on which it was created.
Q
What is the current version of GitLab?
A
This is the latest version of gitlab-ce-14.4.2-ce.0.el8.x86_64.rpm.
Q
What is GitLab rake?
A
GitLab provides Rake tasks to assist you with common administration and operational processes. You can perform GitLab Rake tasks by using:

gitlab-rake for Omnibus GitLab installations. bundle exec rake for source installations.
Q
What is the configuration file for Gitlab?
A
vim /etc/gitlab/gitlab.rb
Q
Where does GitLab backup to?
A
All configuration for Omnibus GitLab is stored in /etc/gitlab . To backup your configuration, just run sudo gitlab-ctl backup-etc,

It will create a tar archive in /etc/gitlab/config_backup/.