Find file
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (66 sloc) 2.29 KB


New App (no staging server)

Initial creation:

$ heroku create

Push to server:

$ git push heroku master

Rename app name:

$ heroku apps:rename newname

Migrate the database:

$ heroku run rake db:migrate

New App (production / staging servers)

Setup staging server:

$ heroku create --remote staging

Push to staging server:

$ git push staging master

Migrate staging server:

$ heroku run rake db:migrate --remote staging

Setup production server:

$ heroku create --remote production

Push to production server:

$ git push production master

Migrate the database:

$ heroku run rake db:migrate --remote production

Rename production / staging app names:

$ heroku apps:rename newname --remote staging


$ heroku apps:rename newname --remote production

Link local app to existing Heroku App

Type this in the command line where 'project' is the name of your heroku app

$ git remote add heroku

Restart Dynos

$ heroku restart


$ heroku restart --app app-name

Configuring Remotes

To view your remotes

$ git remote -v

You should see something like this (this one has a staging server):

heroku (fetch)
heroku (push)
origin (fetch)
origin (push)
staging (fetch)
staging (push)

To remove a remote:

$ git remote rm staging

or (depending on the remote environment)

$ git remote rm heroku

To add a remote

$ git remote add heroku

or (depending on the remote environment)

$ git remote add staging

Run console

Single environment

$ heroku run console

Mutliple environment

$ heroku run -a app-name console
ex: "heroku run jamify console"

Setting timezone in producion / staging environments:

$ heroku config:add TZ="America/Los_Angeles" --app production-app-name

Cloning production data into local machine

$ heroku pg:backups capture
$ curl -o latest.dump `heroku pg:backups public-url`
$ rake db:drop
$ rake db:create
$ pg_restore --verbose --clean -d penny-stock-mailer_development latest.dump