This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"postdeploy": "pg_dump -Fc $DATABASE_URL_TO_COPY | pg_restore --clean --no-owner -n public -d $DATABASE_URL && bundle exec rails db:migrate" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
desc "Backs up heroku database and restores it locally." | |
task import_from_heroku: [ :environment, :create ] do | |
HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
c = Rails.configuration.database_configuration[Rails.env] | |
heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
Bundler.with_clean_env do | |
puts "[1/4] Capturing backup on Heroku" | |
`heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!usr/bin/env ruby | |
# This script takes a list of filenames from a given file and copies | |
# each of those files from one S3 bucket to another using the s3mcd library. | |
# Inputfile should have each filename termination by a newline character. | |
file, from, to = ARGV[0], ARGV[1], ARGV[2] | |
if file.nil? || from.nil? || to.nil? | |
puts "Invalid arguements. Should be filename from-s3-bucket to-s3-bucket" |