Lab notes: Gitlab container backup

A quick note about how to backup a self hosted Gitlab container.

Hosting my code in a private git repository was in my initial plans for the container edition of my home-server.

The installation with docker-compose was straightforward.

I published the container behind an Nginx Proxy Manager secured with an Let's Encrypt certificate and 2FA.

How to backup

Create a backup

docker exec -t gitlab gitlab-backup create

Verify the backup was created

docker exec -t gitlab ls -lsha /var/opt/gitlab/backups

Copy the backup files to a safe place

docker cp gitlab:/var/opt/gitlab/backups/. /mnt/nas/backup/cargo/gitlab

Customize retention

## Limit backup lifetime to 7 days - 604800 seconds
gitlab_rails['backup_keep_time'] = 604800

And rembember to include the config and secrets in the backup

Warning

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.

LINKS