简体   繁体   English

如何在Heroku上重启rails服务器?

[英]How to restart a rails server on Heroku?

Locally I just interrupt (ctrl-c) and then start it again. 在本地我只是中断(ctrl-c)然后再次启动它。

How do I do the same thing with an app on heroku? 如何使用heroku上的应用程序执行相同的操作?

The answer was: 答案是:

heroku restart -a app_name

# The -a is the same as --app

Easily aliased with alias hra='heroku restart --app ' 别名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 您可以通过将其添加到.bashrc或.bash_aliases文件中来创建永久别名,如下所述: 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 然后你可以输入hra app_name

You can restart a specific remote, eg "staging" with: 您可以重新启动特定的遥控器,例如“staging”:

heroku restart -a app_name -r remote_name

Alternatively if you are in the root directory of your rails application you can just type 或者,如果您位于rails应用程序的根目录中,则只需键入即可

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 您可以将这些别名放在.bashrc文件中,或者(首选)放在.bashrc调用的.bash_aliases文件中

进入终端上的应用程序目录并运行以下命令:

heroku restart

Just type the following commands from console. 只需从控制台键入以下命令即可。

cd /your_project
heroku restart

如果您有多个heroku应用程序,则必须键入heroku restart --app app_nameheroku restart -a app_name

heroku ps:restart [web|worker] --app app_name

works for all processes declared in your Procfile. 适用于Procfile中声明的所有进程。 So if you have multiple web processes or worker processes, each labeled with a number, you can selectively restart one of them: 因此,如果您有多个Web进程或工作进程,每个进程都标有数字,您可以有选择地重新启动其中一个:

heroku ps:restart web.2 --app app_name
heroku ps:restart worker.3 --app app_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM