Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding: utf-8
- #
- ##
- # Backup Generated: sample_backup
- # Once configured, you can run the backup with the following command:
- #
- # RAILS_ENV=production backup perform --trigger daily_backup -c ./config/backup.rb
- #
- #
- require 'yaml'
- RAILS_ROOT = File.join(File.dirname(__FILE__), "..")
- DATABASE_YML = File.join(RAILS_ROOT, "config", "database.yml")
- RAILS_ENV = ENV['RAILS_ENV'] || 'development'
- $config = YAML.load_file(DATABASE_YML)
- Backup::Model.new(:daily_backup, 'db and log to sftp') do
- split_into_chunks_of 50
- database MySQL 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.socket = $config[RAILS_ENV]["socket"]
- db.additional_options = ["--quick", "--single-transaction"]
- end
- archive :logs do |archive|
- archive.add "#{RAILS_ROOT}/log/production.log"
- end
- store_with SFTP do |server|
- server.username = 'sftp_user'
- server.password = 'sftp_pwd'
- server.ip = 'sftp_ip'
- server.port = 22
- server.path = 'backups/'
- server.keep = 5
- end
- compress_with Gzip do |compression|
- compression.level = 6
- end
- notify_by Mail do |mail|
- mail.on_success = true
- mail.on_warning = true
- mail.on_failure = true
- mail.from = 'notify_user@gmail.com'
- mail.to = 'receive@gmail.com'
- mail.address = 'smtp.gmail.com'
- mail.port = 587
- mail.domain = 'agideo.com'
- mail.user_name = 'notify_user@gmail.com'
- mail.password = 'notify_pwd'
- mail.authentication = 'plain'
- mail.enable_starttls_auto = true
- end
- end
Add Comment
Please, Sign In to add comment