Backup file for the backup of Postgresql to Dropbox account
# encoding: utf-8
##
# Backup Generated: my_backup
# Once configured, you can run the backup with the following command:
#
# $ backup perform -t my_backup [-c <path_to_configuration_file>]
#
database_yml = File.expand_path('/opt/deployed/application/current/config/database.yml', __FILE__)
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
require 'yaml'
config = YAML.load_file(database_yml)
Backup::Model.new(:my_backup, 'Backup for the my\'s production instance') do
##
# Split [Splitter]
#
# Split the backup file in to chunks of 250 megabytes
# if the backup file size exceeds 250 megabytes
#
split_into_chunks_of 250
##
# PostgreSQL [Database]
#
database PostgreSQL do |db|
db.name = config[RAILS_ENV]["database"]
db.username = config[RAILS_ENV]["username"]
db.password = config[RAILS_ENV]["password"]
db.host = config[RAILS_ENV]["host"]
db.port = config[RAILS_ENV]["port"]
db.skip_tables = []
db.additional_options = ["-xc", "-E=utf8"]
# Optional: Use to set the location of this utility
# if it cannot be found by name in your $PATH
# db.pg_dump_utility = "/opt/local/bin/pg_dump"
end
##
# Dropbox File Hosting Service [Storage]
#
# Access Type:
#
# - :app_folder (Default)
# - :dropbox
#
# Note:
#
# Initial backup must be performed manually to authorize
# this machine with your Dropbox account.
#
store_with Dropbox do |db|
db.api_key = "api_key"
db.api_secret = "api_secret"
db.access_type = :app_folder
db.path = "backups"
db.keep = 25
end
##
# Mail [Notifier]
#
# The default delivery method for Mail Notifiers is 'SMTP'.
# See the Wiki for other delivery options.
# https://github.com/meskyanichi/backup/wiki/Notifiers
#
notify_by Mail do |mail|
mail.on_success = true
mail.on_warning = true
mail.on_failure = true
mail.from = "correo@ejemplo.com"
mail.to = "correo@ejemplo.com"
mail.address = "smtp.gmail.com"
mail.port = 587
mail.domain = "dominio"
mail.user_name = "correo@ejemplo.com"
mail.password = "pa$$word"
mail.authentication = "plain"
mail.enable_starttls_auto = true
end
compress_with Gzip do |compression|
compression.level = 6
end
end