Backing Up: Backup Ruby Gem

Backing up has never been easier with a little Ruby gem – backup. It offers huge array of features including various database adapters, flexible filesystem archiving, compression, encryption, backup destinations and synchronization. Every option is explained in its corresponding section in details.

Let’s take a real example and I’ll show how I handled it. I have a web application for photo archiving, comments and blogging within the close family circle – family_hut. As you may guess, I want to send the database and uploads snapshot offsite. For this I have an S3 account with a family-hut bucket.

Backup gem needs a little configuration file that in pure Ruby language describes what to take and where to put. Here’s my final configuration:

Here I tell to dump ag_family database and archive /app/shared/assets into the tar named assets. Everything is packed into a nice timestamped file and sent over to S3 bucket named family-hut where I keep 8 last snapshots. The result, good or bad, is emailed to me.

Note that you could have several databases and archives backed up at once. Each archive could have multiple locations in it as well. Finally, you can compress the archive before sending and it saves a lot of space, but not with images, and that’s why I didn’t bother. And destinations range from local, to SCP / RSync / FTP aware, to Amazon S3 or Rackspace CloudFiles and more.

I barely scratched the surface with this, but there’s no need to copy documentation. Hope the introduction was helpful.

Remember, that it’s all pretty generic and even if you are not into Ruby or Ruby development, you can still use this to quickly configure snapshotting for your important files.