How to Backup Gitlab Repository

Posted on

Introduction on the Gitlab

As specifies in the title of the article, the content of this article is about how to backup Gitlab repository. Before proceeding into the actual backup process, first of all there is an description about gitlab. Referring to the Gitlab official website in this link, there is a certain definition of the GitLab itself. According to the page, Gitlab is the first single application built from the ground up for all stages of the DevOps lifecycle. Those stages including all of the people from all areas. It involves the Product, Development, QA, Security, and Operations teams to work concurrently on the same project using Gitlab.

So, GitLab enables all teams to collaborate and work from a single conversation, instead of managing multiple threads across disparate tools. Furthermore, GitLab provides teams a single data store, one user interface, and one permission model across the DevOps lifecycle allowing teams to collaborate, significantly reducing cycle time and focus exclusively on building great software quickly.

Executing the command to backup Gitlab Repository

The following is the step for executing the backup process in Gitlab repository.

1. The first step, obviously executing the suitable command in the CLI (Command Line Interface) to perform Gitlab repository backup.

[root@gitlab ~]# gitlab-rake gitlab:backup:create
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
Dumping repositories ...
 * xxxxx/xxxxxxxxx ... [SKIPPED]
 * xxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxx ... [DONE] 
Dumping uploads ... 
Dumping builds ... 
Dumping artifacts ... 
Dumping lfs objects ... 
Dumping container registry images ... 
Creating backup archive: 1542770671_2018_11_21_11.4.5_gitlab_backup.tar ... 
Backup success
[root@hostname ~]#

2. Finally, after successfully executing the command in the previous step, don’t forget to check the backup file. The file exists in the /var/opt/gitlab/backups. Check it by executing the following command :

root@hostname:/var/opt/gitlab/backups# ls -al
total 156
drwx------  3 git  root  4096 Dec  5 21:31 .
drwxr-xr-x 20 root root  4096 Nov 26 09:09 ..
-rw-------  1 git  git  71680 Nov 21 10:24 1542770671_2018_11_21_11.4.5_gitlab_backup.tar
-rw-------  1 git  git  71680 Nov 23 14:38 1542958716_2018_11_23_11.4.6_gitlab_backup.tar
drwxr-xr-x  2 git  git   4096 Dec  5 21:31 db

3. In summary, since the process is a success and the backup file exist, overall, the backup process is a success.

Leave a Reply