Backuper is a simple server backup tool written in Ruby. It is aimed to backup a Rails application (file assets and database) to a remote SSH server (using rsync).
sudo gem install backuper
Configure and run the backup :
Backuper.new do set :source_path, '/var/apps/blop/current/shared/system' set :local_backup_base_path, '/var/backups/blop' set :remote_backup_ssh_info, 'username@host:/path/to/backups/blop' set :max_kept_backups, 30 set :mysql_params, YAML::load(File.read('config/database.yml'))['production'] end
No trailing slashes anywhere. The path in remote_backup_ssh_info must be the parent directory where different backups are stored (other applications). Put this in a script (e.g., script/backup.rb) and make it executable (*chmod +x*).
Don’t forget to set up the public keys, it won’t work with password authentication.
Add a line to your crontab with *crontab -e* to run the script.
Or use whenever with in your config/schedule.rb :
every 1.day, :at => '4am' do
command “cd #{File.dirname(File.expand_path(__FILE__))} && ruby script/backup.rb” end
© 2009 Aurélien Malisart aurelien.malisart.be
This is open source software released under GNU GPLv3 license. www.gnu.org/copyleft/gpl.html