Skip to content

Latest commit

 

History

History
119 lines (66 loc) · 2.29 KB

heroku.rdoc

File metadata and controls

119 lines (66 loc) · 2.29 KB

Heroku

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

-or-

$ 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 git@heroku.com:project.git

Restart Dynos

$ heroku restart

or

$ 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  git@heroku.com:peaceful-tor-9413.git (fetch)
heroku  git@heroku.com:peaceful-tor-9413.git (push)
origin  https://github.com/nemrow/meat_app_2.git (fetch)
origin  https://github.com/nemrow/meat_app_2.git (push)
staging git@heroku.com:meat-app-staging.git (fetch)
staging git@heroku.com:meat-app-staging.git (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 git@heroku.com:yourappname.git

or (depending on the remote environment)

$ git remote add staging git@heroku.com:yourappname.git

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