If you run a business or application built with Rails then one of the key first things to address is ensuring things are always backed up, daily where possible. I’m sure you’ve all heard the horror stories, there are lots of them.
There’s a few things to consider here:
- The cost needed to develop a solution to manage the backups
- Where to store the backups
- The cost of storage associated with the backups
- The impact running a backup might have on the current server resources
- How to restore backups in the event of a crash/hack
Luckily for you, there’s a number of solutions out there that not only make backups a breeze, but also do in a very, very cost efficient manner.
Almost all of the solutions below utilize Amazon’s S3 storage, which costs around $0.15 per GB / month to store data.
Things get more expensive when you need to backup Photos, Videos or other large media files. But for your site, database & any repositories it should be extremely cheap.One thing to note also is that Amazon keeps up to 3 copies of your backups in at least 2 different geographical locations, which is a major win.
Libraries / Gems / Plugins
Adam’s S3 Rake Task
Adam’s Rake Task makes it incredibly easy to get backups up & running in a matter of minutes. Once installed you can backup quicky with the rake command:
rake s3:backup
Backup Fu
Backup Fu is another rake task that (in their own words) makes backups redonkulously easy. This gem also allows the restore of PostgreSQL databases.
There’s also a very very handy restore command:
BACKUP_FILE=myapp_1999-12-31_12345679_db.tar.gz rake backup_fu:restore
Backup Gem
Backup is a very powerful & configurable gem. You can specify some of the following options:
- What is being archived (files, folders, arbitrary scripts)
- How it’s being archived (tar gzip, bz2)
- Where the archive is going (multiple backup servers? easy)
- How the archive is going to get there (scp, ftp, mv)
- Where is will be stored when it gets there
- How it’s going to be rotated when it gets there (grandfather-father-son, etc)
- How often will this process happen (customizable cycles)
- What happens to the working copy after the process (recreate files, folders etc. restart daemons)
Backup
Backup is another Ruby Gem that offers encryption & cycling with backups. You can also choose to receive email notifications when backups are completed. You don’t have to use Amazon S3 with Backup, you can choose to backup anywhere that you can SCP or SFTP into.
DB2S3
DB2S3 is written by a fellow melburnian Xavier Shay, it allows you to quite simply back up your DB & archive on Amazon S3. It also has a handy restore feature:
rake db2s3:backup:restore
AWSS-3
AWSS-3 is a Ruby Library for Amazon’s S3 REST API. This gives you much more control over what you want to store & how you want to store it (buckets). You will need to create your own rake task using the library to back up your data, but you’ll have increased flexibility.
WordPress S3 Backups via Rails
Chances are if you run an application you might have a blog (just like this one) to communicate with your customers or audience. The changing nature of blogging platforms (WordPress is no exception here) leaves blog highly vulnerable to hacking. We covered briefly before how to automate your wordpress updgrades via the commandline.
The WordPress S3 Backup plugin allows you to backup your blog with a rake task (which you can set via a nightly cronjob).
Applications
Backup My App

Backup My App is exclusively for Ruby on Rails applications & provides a visual interface for Backups. You can view changes, browse previous backups & restore.
There’s a free plan that allows you to store up to 1GB. They do however charge $0.60 per Gigabyte ($0.45 more than S3 using the gems/plugins above).
Dropbox
Whilst Dropbox doesn’t provide SSH access you can still SSH to a box that has Dropbox installed then use SCP to copy your backups (which are then synced to anyone that is shared to that folder).
Enjoy Shopping? StoreCrowd launches beta on Oct 4th. Join us for an advanced preview & become the Boss of your favourite store
