curl https://cli-assets.heroku.com/install.sh | sh
heroku login
heroku git:remote -r staging -a <staging-app>
heroku git:remote -r production -a <production-app>
See env vars doc.
# list vars
heroku config -r staging
# set var
heroku config:set FOO='barbaz' -r staging
# remove var
heroku config:remove FOO -r staging
heroku logs -t -r staging
heroku console -r staging
After creating the new db, also need to setup the scheduler
heroku pg:backups:schedule DATABASE_URL --at '04:00 America/Chicago' --app madness
heroku pg:backups:url -r production | xargs heroku pg:backups:restore -r staging --confirm madness-staging
heroku pg:backups:capture -a madness-staging
heroku pg:backups:download -a madness-staging
rails db:drop:all
rails db:create:all
pg_restore --verbose --clean --no-acl --no-owner -d madness_development latest.dump
After re-enabling Postgres, the backups are on the dashboard. Find the latest backup. For example ‘b2955’.
heroku pg:backups:restore b2955 DATABASE_URL -a madness-staging