GitLab backup and restore

Rehearse a self-managed GitLab restore without touching the live instance.

Last updated

On this page (6)

GitLab · Backup and restore

Before you start

  • Exact source GitLab version and CE/EE type; deployment-specific backup tooling.
  • Isolated target, protected configuration and secrets, and recovery copies of any separately stored objects.

Capture a complete recovery set

  1. For a Linux package deployment, run sudo gitlab-backup create and verify the resulting archive. On Helm, use the Toolbox backup workflow instead. Record the GitLab version and whether it is CE or EE: the restore target must match both exactly.
  2. On the Linux package, protect /etc/gitlab/gitlab.rb and /etc/gitlab/gitlab-secrets.json separately. The application archive does not replace these files. The secrets are required to decrypt database fields such as CI/CD variables. Treat them as credentials; restrict access separately from the archive.
  3. Record repository storage names and the backing stores for uploads, artifacts, LFS, packages and the registry. If any live in object storage, check whether your deployment’s backup tool covers them and capture the rest separately. Record the recovery point of every copy.

Restore to an isolated target

Install the matching GitLab build. Use recovery buckets and block production runner registration, outbound email and webhooks before starting. On a Linux package target, follow GitLab’s restore sequence to load the configuration and secrets, then stop Puma and Sidekiq and run sudo gitlab-backup restore BACKUP=<backup-id> using the archive name without _gitlab_backup.tar. This overwrites destination data; do not point the command or its storage configuration at production. Use the Toolbox restore workflow instead for Helm.

Verify the result

  • On a Linux package target, run sudo gitlab-rake gitlab:check SANITIZE=true and sudo gitlab-rake gitlab:doctor:secrets after bringing the restored instance up. Clone a sample project and compare a known commit.
  • Open a merge request, retrieve a known object-backed artifact or registry image if in scope, and check one representative credential-backed workflow in isolation.
  • Measure the time from the start of restore to usable access, and record the newest confirmed data point. A successful archive upload measures neither.

Official documentation

Have Pilae operate GitLab

We agree what to monitor, how to recover and who responds when something breaks. Bring your existing deployment or start with a new one.