247

Locally I just interrupt (ctrl-c) and then start it again.

How do I do the same thing with an app on heroku?

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • Be careful not to over-eagerly translate the development environment's `$ rails restart` into its equivalent on Heroku: `$ heroku rails restart`. This command relies on `spring` which (usually) won't be installed on Heroku. Therefore go with `heroku restart` like the others have said. – Jack Kinsella Jan 15 '20 at 13:57

5 Answers5

472

The answer was:

heroku restart -a app_name

# The -a is the same as --app

Easily aliased with alias hra='heroku restart --app '
Which you can make a permanent alias by adding it to your .bashrc or .bash_aliases file as described at: https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias and
Creating permanent executable aliases
Then you can just type hra app_name

You can restart a specific remote, e.g. "staging" with:

heroku restart -a app_name -r remote_name

Alternatively if you are in the root directory of your rails application you can just type

heroku restart

to restart that app and and you can create an easy alias for that with

alias hr='heroku restart'`

You can place these aliases in your .bashrc file or (preferred) in a .bash_aliases file which is called from .bashrc

Community
  • 1
  • 1
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • 2
    Also, if you're getting the message `No web processes running` -- that's because you're on zero dynos -- log in to heroku and scale up your app -- that's how I landed on this question. – Yuval Karmi Mar 04 '14 at 04:09
  • 2
    If you have multiple heroku remotes for your app, such as a staging or production environment, you'll need to run the following from your app root: `heroku restart -r `, for instance `heroku restart -r production` – armchairdj May 07 '14 at 03:03
  • 2
    eh, why it's not on `-h` listing. – Sławomir Lenart Jun 22 '17 at 15:01
38

Go into your application directory on terminal and run following command:

heroku restart
Sergey Kishenin
  • 5,099
  • 3
  • 30
  • 50
RAJ
  • 9,697
  • 1
  • 33
  • 63
24

If you have several heroku apps, you must type heroku restart --app app_name or heroku restart -a app_name

matiasdim
  • 527
  • 5
  • 14
17

Just type the following commands from console.

cd /your_project
heroku restart
J. Steen
  • 15,470
  • 15
  • 56
  • 63
vijay chouhan
  • 1,012
  • 8
  • 25
16
heroku ps:restart [web|worker] --app app_name

works for all processes declared in your Procfile. So if you have multiple web processes or worker processes, each labeled with a number, you can selectively restart one of them:

heroku ps:restart web.2 --app app_name
heroku ps:restart worker.3 --app app_name
catsby
  • 11,276
  • 3
  • 37
  • 37