How to Create Backup and Restore in Gitlab-CE 14.4.2 on Oracle Linux 8.5

To Create Backup and Restore in GitLab-CE 14.4.2 on Oracle Linux 8.5

Introduction

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 of GitLab on which it was created.

Installation Procedure:

Step1: Check the OS version by using the below command

[root@linuxhelp ]# cat /etc/os-release 
NAME="Oracle Linux Server"
VERSION="8.5"
ID="ol"

Step 2: To take the complete backup use the below command

[root@linuxhelp ~]# gitlab-rake gitlab:backup:create 
Dumping database ... 
[SKIPPED]
Dumping repositories ...
.
.
.
done
done
Deleting old backups ... skipping

Step 3: To skip some fields and take backup use the below command.

[root@linuxhelp ~]# gitlab-rake gitlab:backup:create  SKIP = db,uploads
Dumping database ... 
[SKIPPED]
Dumping repositories ...
.
.
.
done
done
Deleting old backups ... skipping

Step 4: To View the backup location use the below command

[root@linuxhelp ]# cd /var/opt/gitlab/backups/
[root@linuxhelp backups]# ls
1654733800_2022_06_09_14.4.2_gitlab_backup.tar

Step 5: After creating backup, Delete the user in the group on GitLab as shown in the below images

Step 6: Restore the backup by running the below command.

[root@ linuxhelp~]# gitlab-rake gitlab:backup:restoreBACKUP=1654733800_2022_06_09_14.4.2
2022-06-09 05:50:01 +0530 -- Restoring lfs objects ... 
2022-06-09 05:50:01 +0530 -- done
This task will now rebuild the authorized_keys file.
You will lose any data stored in the authorized_keys file.
Do you want to continue (yes/no)? yes

Step 7: To check configuration status of GitLab use the below command.

[root@linuxhelp~]# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...
GitLab Shell version > = 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
.
.
.
Your git bin path is " /opt/gitlab/embedded/bin/git" 
Git version > = 2.7.3 ? ... yes (2.10.2)
Active users: 1
Checking GitLab ... Finished

Step 8: Now Login to GitLab and check whether the deleted user is restored as shown in the below image

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to Create Backup and Restore in GitLab-CE 14.4.2 on Oracle Linux 8.5 . Your feedback is much welcome.

FAQ
Q
Does GitLab need a database?
A
GitLab supports only the PostgreSQL database management system.
Q
How much RAM does GitLab use?
A
You need at least 2GB of addressable memory (RAM + swap) to install and use GitLab.
Q
Where are GitLab issues stored?
A
The uploads are stored by default in /home/git/gitlab/public/uploads.
Q
Can we recover deleted branch in GitLab?
A
GitLab has not implemented this feature at the time of this writing.
Q
How does GitLab backup work?
A
An application data backup creates an archive file that contains the database, all repositories, and all attachments.