Skip to content

Commit

Permalink
add require 'aws/s3' to rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
kamui committed Aug 23, 2010
1 parent fc8f9c8 commit b26ac15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 12 additions & 1 deletion README
Expand Up @@ -2,4 +2,15 @@ Derek's Heroku Tools!

Whats here?

- backup.rake - Really simple backup rake task that extracts raw postgresql dumps and can send them to S3 for you! Works great with Heroku cron!
- backup.rake - Really simple backup rake task that extracts raw postgresql dumps and can send them to S3 for you! Works great with Heroku cron!

Setup:
1) replace APP_NAME and BACKUP_BUCKET with your info
2) heroku config:add S3_KEY=YOURKEY S3_SECRET=YOURSECRET
3) add aws-s3 to your .gems

Usage:
heroku rake backups:backup

* or add this to your cron.rake for hourly or nightly backups (ie, lib/tasks/cron.rake):
Rake::Task['backups:backup'].invoke
7 changes: 4 additions & 3 deletions backup.rake
@@ -1,4 +1,5 @@
require 'yaml'
require 'aws/s3'

# Heroku SQL to S3 Database backup task
# by Derek Perez (March 15th, 2010), inspiration from Nick Merwin (Lemur Heavy Industries)
Expand All @@ -11,16 +12,16 @@ require 'yaml'
#
# Usage:
# heroku rake backups:backup
# * or add this to your cron.rake for hourly or nightly backups:
# * or add this to your cron.rake for hourly or nightly backups (ie, lib/tasks/cron.rake):
# Rake::Task['backups:backup'].invoke

namespace :backups do

desc "backup db from heroku and send to S3"
task :backup => :environment do

APP_NAME = 'hnj' # put your app name here
BACKUP_BUCKET = 'hnj-db-backups' # put your backup bucket name here
APP_NAME = 'heroku-app-name' # put your app name here
BACKUP_BUCKET = 'heroku-app-name-db-backups' # put your backup bucket name here
DB_CONFIG = YAML::load(ERB.new(IO.read(File.join(RAILS_ROOT, 'config', 'database.yml'))).result)[RAILS_ENV]

puts "backup started @ #{Time.now}"
Expand Down

0 comments on commit b26ac15

Please sign in to comment.