Table of Contents

Gitlab backup

Making backup

Make backup without repository

gitlab-rake gitlab:backup:create SKIP=repositories,uploads

For possible rake tasks to skip see into file /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake. For now it cane be: repositories,db,builds,uploads,artifacts,lfs

Automating backups

crontab -e

0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

What is in backup

Backup file e.g.: 1462327272_gitlab_backup.tar is simple tar archive with example content:

|-- artifacts.tar.gz
|-- backup_information.yml
|-- builds.tar.gz
|-- db
|   `-- database.sql.gz
|-- lfs.tar.gz
|-- repositories
|   |-- group1
|   |   |-- http-server.bundle
|   |   |-- kernel.bundle
|   |-- group2
|   |   |-- buildroot.bundle
|   |   |-- linux-stable.bundle
|   |   |-- u-boot.bundle
|   |   `-- yocto.bundle
|   `-- user1
|       |-- buildroot.bundle
|       |-- linux-stable.bundle
|       |-- linux.bundle
|       |-- uboot.bundle
`-- uploads.tar.gz

Where .bundle filesa re simple tar archives of bare git repos.

Restoring backup

sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status