Every application in production needs some sort of database backup scheme. There are plenty of methodologies and several Rails scripts or plugins to do just that. Here’s a brief summary of some of the popular ones:
- ar-backup is a Rails plugin which saves data as fixtures. The data of course becomes database independent. However, to store it safely you will have to push them to your SCM or manage backups separately.
- A comprehensive backup system of DB data, code and SCM to Amazon S3 is on Ruby Inside
- here is a simple rake task to take a mysqldump and push it to S3. There is no scheme for rolling backups, but if you want a simple solution, this may be enough.
- For a large database where full backups may be expensive, see this. There’s also a Rails plugin using this, however at the time of writing it seems incomplete.
- The awesome guys at Collective Idea have a polished Rails plugin: for backing up the database as fixtures. It also has some nifty features like ability to pull data back into development server. Read about it here
- Finally, a novel approach of backing up the database in a Git repository which seems will work for databases which are not growing very rapidly.
However, surprisingly, none of them fitted exactly what I needed and so I decided to roll my own. Also, it is quite straightforward as you will see. This is what I wanted from a DB backup system:



