How to restart a rails server on Heroku?

Ruby on-RailsRuby on-Rails-3Heroku

Ruby on-Rails Problem Overview


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

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

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

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
https://stackoverflow.com/questions/5137726/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

Solution 2 - Ruby on-Rails

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

heroku restart

Solution 3 - Ruby on-Rails

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

Solution 4 - Ruby on-Rails

Just type the following commands from console.

cd /your_project
heroku restart

Solution 5 - Ruby on-Rails

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichael DurrantView Question on Stackoverflow
Solution 1 - Ruby on-RailsMichael DurrantView Answer on Stackoverflow
Solution 2 - Ruby on-RailsRAJView Answer on Stackoverflow
Solution 3 - Ruby on-RailsmatiasdimView Answer on Stackoverflow
Solution 4 - Ruby on-Railsvijay chouhanView Answer on Stackoverflow
Solution 5 - Ruby on-RailscatsbyView Answer on Stackoverflow