Skip to content

Instantly share code, notes, and snippets.

@andrewsomething
Last active March 28, 2023 08:30
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewsomething/ae926930fe757898bb497373e8a7a6db to your computer and use it in GitHub Desktop.
Save andrewsomething/ae926930fe757898bb497373e8a7a6db 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.

@MayMeow
Copy link

MayMeow commented Dec 16, 2017

im getting error 403 everytime i try to backup

@andrewsomething
Copy link
Author

Do you have the full error message? A 403 could mean a number of things, but the first thing I'd double check is that the credentials are correct.

@JohnnyCosta
Copy link

I am getting error code: 411 Length Required
Any idea?

@williamboman
Copy link

williamboman commented Jan 19, 2018

I'm also getting 403s. On gitlab/gitlab-ce:latest (as of writing). Error code according to response body is SignatureDoesNotMatch. I've tried regenerating Spaces access keys @ DigitalOcean, still no luck.

@JohnnyCosta
Copy link

Try to include 'aws_signature_version' => 2, it may fix it. In my case, I got more exceptions.
I have a ticket open at:
https://gitlab.com/gitlab-org/gitlab-ee/issues/4419

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