There is a gem db2fog
but it works only with Rails 3.
Is there anyting suitable for making databases backups in Rails 4?
Take a look to Backup gem. It provides a very nice set of features like:
The plugin is totally independent to Rails
, so you can use it for other applications.
Backup model example (MySQL, Amazon, Gzip and email notifications):
Model.new(:my_backup, 'My backup description') do
database MySQL do |db|
db.name = "database_name"
db.username = "username"
db.password = "pass"
db.host = "localhost"
db.port = 3306
end
store_with S3 do |s3|
s3.access_key_id = "access_key_id"
s3.secret_access_key = "secret_access_key"
s3.bucket = "bucket_name"
s3.path = "path/to/your/backups"
end
compress_with Gzip
notify_by Mail do |mail|
mail.on_success = true
mail.on_warning = true
mail.on_failure = true
mail.from = "[email protected]"
mail.to = "[email protected]"
mail.address = "smtp.gmail.com"
mail.port = 587
mail.domain = "your.host.name"
mail.user_name = "[email protected]"
mail.password = "pass"
mail.authentication = "plain"
end
end
Perform the backup:
$ backup perform --trigger my_backup
Schedule your backups with a cron job (for example with whenever
gem) and you'll achieve a simple and effective solution:
every 1.day, :at => '1:00 am' do
command "backup perform --trigger my_backup"
end
Hope this can help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With