Skip to content

Instantly share code, notes, and snippets.

@muocod
Forked from andrewsomething/BACKUP.md
Created March 28, 2023 08:30
Show Gist options
  • Save muocod/ff5c4641b62d82b017f5decd326df815 to your computer and use it in GitHub Desktop.
Save muocod/ff5c4641b62d82b017f5decd326df815 to your computer and use it in GitHub Desktop.
Backup GitLab to DigitalOcean Spaces

Backup GitLab to DigitalOcean Spaces

GitLab uses Fog to communicate with various object storage services when running backups. Fog works with S3 as well as S3-compatible services like Spaces. The key difference is that you need to explictly set the endpoint for non-S3 services. If you are using the "ominbus" GitLab packages, you would need to add the following to /etc/gitlab/gitlab.rb:

gitlab_rails['backup_upload_connection'] = {
  'provider'              => 'AWS',
  'region'                => 'nyc3',
  'aws_access_key_id'     => 'YOUR_SPACES_KEYY',
  'aws_secret_access_key' => 'YOUR_SPACES_SECRET',
  'endpoint'              => 'https://nyc3.digitaloceanspaces.com'
}
gitlab_rails['backup_upload_remote_directory'] = 'name-of-my-space'

After making that addition, GitLab must be reconfigured for the change to take effect:

gitlab-ctl reconfigure

Finally, you can run a backup with:

gitlab-rake gitlab:backup:create

See the full GitLab "Uploading backups to a remote (cloud) storage" docs for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment