Backing up with S3

Last night, I threw together a little script for backing up content from my web server to Amazon S3. It’s not really feature complete, but it is good enough for what I need for now. It provides a very simple DSL for specifying what content should be backed up.

Download it here.

To specify content:

backup :foo do
  folder '/path/to/stuff'
  folders ['/path/to/things', '/path/to/blah']
  file '/path/to/allyourbase.rb'
end

Will produce this in S3:

-{date stamp}
  -foo
    -stuff
      -..content of stuff
    -things
      -..content of things
    -blah
      -..content of blah
    -allyourbase.rb

The idea is that you could have one backup block for each site (notice how the symbol passed to the block becomes the root folder). You could backup all the different parts of the application under one umbrella without having to worry about any collisions with other apps.

You’ll need the ‘aws-s3′ gem. To deploy this on your server, just put the files somewhere on your server, modify the configuration in the run_backup.rb script and point a cron task at it.

One Response to “Backing up with S3”

  1. David Recordon Says:

    Check out Brackup. http://search.cpan.org/~bradfitz/Brackup/brackup

Leave a Reply