Heroku

How to create a staging environment
https://agilewarrior.wordpress.com/2014/05/16/how-to-create-a-staging-environment-heroku/

How to create a named app
https://agilewarrior.wordpress.com/2014/05/16/how-to-create-a-named-app-in-heroku/

How to setup staging and prod environments

Clone nutshell and add remotes.

$ git remote add staging https://git.heroku.com/nutshell-staging.git
$ git remote add prod https://git.heroku.com/hidden-ridge-8790.git

Make your changes and commit.
Then push remotely.

$ git push staging
$ git push prod

Database

Pull database locally
$ heroku pgbackups
$ heroku db:pull

Database backup/restore
$ heroku addons:add pgbackups
$ heroku pgbackups:capture
$ heroku pgbackups:restore DATABASE b002
$ heroku pgbackups:destroy b001

Reset database
$ git push heroku
$ heroku pg:reset DATABASE
$ heroku run rake db:migrate
$ heroku run rake db:populate

Migrations not working
$ heroku restart
$ heroku ps –app targetapp (list dynos)
$ heroku ps:restart web.1 –app targetapp

Setup automonth backups
$ heroku pgbackups
$ heroku addons:upgrade pgbackups:auto-month

SQL changes to prod

  1. Pull database local
    $ heroku db:pull

  2. Make changes in prod.rake

  3. Test and run locally
    $ bundle exec rake db:updateprod

  4. Checkin.

  5. Push to prod.

  6. Run against prod
    $ heroku run rake db:updateprod

Environment vars

$ heroku config:set S3_BUCKET=agilenutshell –app targetapp
$ heroku config –app hidden-ridge-8790

Loggin

$ heroku logs –tail –app hidden-ridge-8790

Routes

Adding/removing routes
$ git remote -v
$ git remote rm heroku
$ git remote add heroku get@heroku.com:takemystuff.git

Creating new route

If you have blown away your repo and you need to add your heroku remote instance back do this:

$ heroku create
$ git remote set-url heroku git@heroku.com:hidden-ridge-8790.git

This creates the heroku remote, and then points it to where you want

Pushing to heroku for first time

$ heroku create –stack cedar
$ git push heroku master
$ heroku run rake db:migrate

Mapping git remote back to an existing url

$ git remote add heroku git@heroku.com:hidden-ridge-8790.git

Misc commands

$ heroku run rake db:migrate (–app targetapp)
$ heroku logs (–app targetapp –tail)
$ heroku open
$ heroku run console
$ heroku domains:add academy.robotsandpencils.com
$ heroku info -a secret-waters-xxxx

Images not showing up
http://stackoverflow.com/questions/21974190/background-image-not-showing-up-in-heroku

1 Comment (+add yours?)

  1. How to add a git remote to a heroku app | The Agile Warrior
    Aug 02, 2013 @ 18:10:12

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: