Skip to content

Instantly share code, notes, and snippets.

@ihower
Last active May 17, 2018 22:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ihower/5a28624f9420fb9a7c49 to your computer and use it in GitHub Desktop.
Save ihower/5a28624f9420fb9a7c49 to your computer and use it in GitHub Desktop.
Model.new(:my_backup, 'Backups for alphacamp blog and www') do
##
# MySQL [Database]
#
database MySQL do |db|
# To dump all databases, set `db.name = :all` (or leave blank)
db.name = :all
db.username = "root"
db.password = "xxxxxxxxxxx"
db.host = "localhost"
db.port = 3306
# db.socket = "/tmp/mysql.sock"
# Note: when using `skip_tables` with the `db.name = :all` option,
# table names should be prefixed with a database name.
# e.g. ["db_name.table_to_skip", ...]
# db.skip_tables = ["skip", "these", "tables"]
# db.only_tables = ["only", "these", "tables"]
db.additional_options = ["--quick", "--single-transaction"]
end
##
# Amazon Simple Storage Service [Storage]
#
store_with S3 do |s3|
# AWS Credentials
s3.access_key_id = "xxxxxxxx"
s3.secret_access_key = "xxxxxxx"
# Or, to use a IAM Profile:
# s3.use_iam_profile = true
s3.region = "ap-northeast-1"
s3.bucket = "alphacamp-backups"
s3.path = "blog-production"
end
archive :my_archive do |archive|
# Run the `tar` command using `sudo`
# archive.use_sudo
archive.add "/srv"
end
##
# Gzip [Compressor]
#
compress_with Gzip
##
# Mail [Notifier]
#
# The default delivery method for Mail Notifiers is 'SMTP'.
# See the documentation for other delivery options.
#
notify_by Mail do |mail|
mail.on_success = true
mail.on_warning = true
mail.on_failure = true
mail.from = "backups@alphacamp.co"
mail.to = "engineering@alphacamp.co"
mail.address = "smtp.mailgun.org"
mail.port = 587
mail.domain = "school.alphacamp.co"
mail.user_name = "xxxxxx"
mail.password = "xxxxxx"
mail.authentication = "plain"
mail.encryption = :starttls
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment