Skip to content

Instantly share code, notes, and snippets.

@choyer
Created June 30, 2014 20:38
Show Gist options
  • Save choyer/a11d6fc6822f1dabc33a to your computer and use it in GitHub Desktop.
Save choyer/a11d6fc6822f1dabc33a to your computer and use it in GitHub Desktop.
Backup 4.x Weekly Gitlab Backup Model
Model.new(:weekly_gitlab_backup, 'Weekly Backup for Gitlab') do
archive :gitlab_backup do |archive|
# archive.use_sudo
file_name = Dir.glob('/home/git/gitlab/tmp/backups/*').max_by{|f| File.ctime(f)}
archive.add file_name
end
store_with S3 do |s3|
s3.access_key_id = ENV['S3_ACCESS_KEY_ID']
s3.secret_access_key = ENV['S3_SECRET_ACCESS_KEY']
s3.keep = 10
s3.region = "us-east-1" # http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
s3.bucket = "your-bucket-name"
s3.path = "/weekly"
end
notify_by Pushover do |pushover|
pushover.on_success = true
pushover.on_warning = true
pushover.on_failure = true
pushover.user = ENV['PUSHOVER_USER_KEY']
pushover.token = ENV['PUSHOVER_API_KEY']
pushover.title = 'Gitlab Backup' # optional
#pushover.device = 'The device identifier' # optional
pushover.priority = '0' # optional
end
compress_with Gzip
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment