How to Backup Gitlab

Posted on

Introduction

The following article has a specific content to show how to backup Gitlab. According to its official website in this link, GitLab is a complete DevOps platform, delivered as a single application. It  has lots of features from project planning and source code management to CI/CD, monitoring, and security. Another specific information about Gitlab is available in Wikipedia specifically in this link.

According to the information in Wikipedia, Gitlab is a web-based DevOps lifecycle tool providing Git-repository manager including wiki, issue-tracking and CI/CD pipeline features. It is using an open-source license. Nowadays, Gitlab Inc. is the one responsible for developing Gitlab. Initially, in its early days, Dmitriy Zaporozhets and Valery Sizov was the creator of this software. Currently, several large tech companies including IBM, Sony, NASA, Alibaba, Oracle, Invincea, O’Reilly Media is using Gitlab.

Ruby is the main programming language for developing Gitlab. Later on, some parts is written in Go. Furthermore, Gitlab is as a source code management solution to collaborate with team on software development. Later on, it is evloing into an integrated solution covering the software development life cycle, and then to the whole DevOps life cycle. The current technology stack includes Go, Ruby on Rails and Vue.js. It follows an open-core development model where the core functionality is released under an open source MIT license while the additional functionality is under a proprietary license.

 

 

Gitlab Backup Process

The following is the command for backup Gitlab :

gitlab-rake gitlab:backup:create

The following is the execution of the above command for an example :

[root@gitlab backups]# gitlab-rake gitlab:backup:create
Dumping database ... 
Dumping PostgreSQL database gitlabhq_production ... [DONE]
done
Dumping repositories ...
 * user/app-a ... [SKIPPED]
 * user/app-b ... [DONE]
 * user/app-c ... [DONE]
 * user/app-d ... [DONE]
 * user/app-e ... [DONE]
 * user/app-f ... [SKIPPED]
 ...
 ...
 ...
done
Dumping uploads ... 
done
Dumping builds ... 
done
Dumping artifacts ... 
done
Dumping lfs objects ... 
done
Dumping container registry images ... 
[DISABLED]
Creating backup archive: 1560502009_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
[root@gitlab backups]# 

The backup process is quite simple as it appears in the above output command. The execution of the above command is possible in any directory as long as the command itself is available for execution. The output of the above command will backup all available projects¬† in the Gitlab. If the backup process is a success for every project available in Gitlab, there will be a file exist with the name as in the above output. That file name is ‘1560502009_gitlab_backup.tar’. That file represents all of the backup components for Gitlab. If anything happens, the file is useful as a Gitlab backup data. The restore process will need the file so that the data available in the backup file is safe for further duplication in other running Gitlab service instance.

Leave a Reply