Skip to content

Instantly share code, notes, and snippets.

View mattgaidica's full-sized avatar

Matt Gaidica, Ph.D. mattgaidica

View GitHub Profile
@mattgaidica
mattgaidica / Better Database Pulling With Heroku
Created June 23, 2012 04:37 — forked from jackkinsella/Better Database Pulling With Heroku
Taps isn't reliable for anything but dummy databases. This command invokes the more powerful PGBackups. A side effect is that every time you pull your database locally a backup is also generated on your server.
#!/bin/bash
# Best use case is to create a file "update_local_db.sh" in your project folder and then call the command with bash update_local_db
# Follow me: @jackkinsella
function LastBackupName () {
heroku pgbackups | tail -n 1 | cut -d"|" -f 1
}
# This part assumes you have a low limit on no. of backups allowed
@mattgaidica
mattgaidica / deploy.rake
Created June 23, 2012 04:34 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]