Skip to content

Instantly share code, notes, and snippets.

@blasterpal
Created October 31, 2013 14:06
Show Gist options
  • Select an option

  • Save blasterpal/7250398 to your computer and use it in GitHub Desktop.

Select an option

Save blasterpal/7250398 to your computer and use it in GitHub Desktop.
Backup DB to S3, backup model example.
# encoding: utf-8
##
# Backup Generated: nightly_s3_db
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t nightly_s3_db [-c <path_to_configuration_file>]
# $ backup perform -t nightly_s3_db -c ./config.rb --root_path '/db/backups'
#
Backup::Model.new(:nightly_s3_db, 'Nightly S3 backup of Production database') do
split_into_chunks_of 4000
database MySQL do |database|
database.name = 'myco'
database.username = 'root'
database.password = ''
database.additional_options = ['--single-transaction', '--quick']
database.skip_tables = ['insights', 'versions']
end
compress_with Gzip
store_with S3 do |s3|
s3.access_key_id = ''
s3.secret_access_key = ''
s3.region = 'us-east-1'
s3.bucket = 'mycompany-devops/production-db-backups'
s3.keep = 7
end
notify_by Mail do |mail|
mail.on_success = true
mail.on_warning = true
mail.on_failure = true
mail.from = 'admin@myco.com'
mail.to = ''
mail.address = 'smtp.sendgrid.net'
mail.domain = 'your.host.name'
mail.user_name = 'admin@myco.com'
mail.password = ''
mail.authentication = 'plain'
mail.enable_starttls_auto = true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment