Backup MySQL to S3 with Rails
Here is some code I wrote over the weekend – db2s3. It’s a rails plugin that provides rake tasks for backing up your database and storing it on Amazon’s S3 cloud storage. S3 is a trivially cheap offsite backup solution – for small databases it costs about 4 cents per month, even if you’re sending full backups every hour.
There are many scripts around that do this already, but they fail to address the biggest actual problem. The aws-s3 gem provides a really nice ruby interface to S3, and dumping a backup then storing it really isn’t that hard. The real problem is that I really hate system administration. I want to spend as little time as possible and I want things to Just Work.
A script is great but there’s still too many things for me to do. Where does it go in my project? How do I set my credentials? How do I call it?
That’s why a plugin was needed. It’s as little work as possible for a rails developer to backup their database, so they can get back to making their app awesome.
db2s3. Check it out.
March 09, 2009 at 9:30 PM
This sounds really neat! I share your pain with sys admin tasks. It's always a chore.
It would be quite interesting if it was possible to hack this to work for other storage methods as well. Say, for example, using scp to push the backups onto another server or something similar. Basically making it storage agnostic.
That would be great because when used in an enterprise environment you'll most likely want to backup to another server rather than S3. I'll check it out and have a tinker.
Cheers
Anton
March 09, 2009 at 10:57 PM
Nice one. Personally, I'd rather copy from my site to my random Dreamhost server to backup. I can pay you in good karma.
March 10, 2009 at 8:43 AM
Have a look at the source - the S3 stuff is abstracted into an S3Store class. It wouldn't be hard to create an SCPStore - it only needs to support store and retrieve. Please, fork away!
February 02, 2010 at 5:35 AM
Zvwxnc <a href="http://hgibsmruyqtz.com/">hgibsmruyqtz</a>, [url=http://xxnrcxvrcbty.com/]xxnrcxvrcbty[/url], [link=http://cxypfvguslrv.com/]cxypfvguslrv[/link], http://hzezfsumhgzx.com/