Model.new(:my_backup,'[describe]')do### MySQL [Database]#databaseMySQLdo|db|# To dump all databases, set `db.name = :all` (or leave blank)db.name="[dbname]"db.username="root"db.password="xxxx"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]## 將備份檔案儲存到S3store_withS3do|s3|# AWS Credentialss3.access_key_id="xxxx"s3.secret_access_key="xxxx"# Or, to use a IAM Profile:# s3.use_iam_profile = trues3.region="ap-northeast-1"s3.bucket="[bucketname]"s3.path="[path]"end# 額外的檔案壓縮,例如用戶上傳的圖片,就可以指定路徑# archive.add “/home/deploy/xxxxxxx/shared/public/systems/# archive :my_archive do |archive|# Run the `tar` command using `sudo`# archive.use_sudo# archive.add "/srv"# end### Gzip [Compressor]#compress_withGzip### Mail [Notifier]## The default delivery method for Mail Notifiers is 'SMTP'.# See the documentation for other delivery options.# 寄信通知,也有很多其他的通知方法,官方文件都有notify_byMaildo|mail|mail.on_success=truemail.on_warning=truemail.on_failure=truemail.from="mail.from"mail.to="mail.to"mail.address="smtp.mailgun.org"mail.port=587mail.domain="mail.domain"mail.user_name="mail.user_name"mail.password="mail.password"mail.authentication="plain"mail.encryption=:starttlsendend