Skip to content

jgrau/bakkuappu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bakkuappu

Features:

* Reliable backups to AWS S3 using heroku's "pgbackup" FREE addon feature
* Reliably and safely handles database backups using multipart uploads
* Reads and write to amazon occur with NO file writes to local file system
* Can be added as a cron job to heroku to be done seamlessly at night

Relies on fog as the S3 client

Description:

All of the heroku automated backup solutions for s3 either are outdated or sadly very unreliable. This gem makes NO use of the tmp folder on heroku as doing so opens up the possibility of corrupted backups should heroku decide to clear it when you are backing up. It also scales to larger databases as solutions using heroku’s tmp folders don’t have any clue how large that directory is or when backups will fail because of size limitations.

Instead of downloading the whole backup in one big download and storing to tmp we instead use Net:Http and its lower level interfaces to get data and send data in ordered chunks using Amazon’s multipart upload rest api. docs.amazonwebservices.com/AmazonS3/latest/API/mpUploadUploadPart.html

Setup

sudo gem install bakkuappu

Configuration

Add a initializer with the following information

Bakkuappu::Configuration.configure do |config|
  config.s3_access_key_id =       #your_s3_access_key_id
  config.s3_secret_access_key =   #your_s3_secret_access_key
  config.s3_bucket =              #your_s3_bucket
  config.heroku_app =             #your_heroku_app
  config.s3_access_policy =       'private'
  config.heroku_user =            #heroku account user_name
  config.heroku_pass =            #heroku account password
end

Running a backup

rake heroku:cron

This task can be linked using the heroku cron addon

Testing the gem

Right now we get a heroku backup url from your app, pull it, md5 hash it
upload it, and compare the hash of the file we pushed to S3. 

To run tests you need to
* copy tests/test_configuration.example.rb to tests/test_configuration.rb and add your information.
* rake test

Contributing to Bakkuappu

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2010 Timothy Cardenas. See LICENSE.txt for further details.