Ruby-on-rails 如何在 Heroku 上重启 Rails 服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14612695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 21:21:12  来源:igfitidea点击:

How to restart a rails server on Heroku?

ruby-on-railsruby-on-rails-3heroku

提问by Michael Durrant

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 上的应用程序做同样的事情?

回答by Michael Durrant

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-aliasand
Creating permanent executable aliases
Then you can just type hra app_name

轻松别名alias hra='heroku restart --app '
您可以通过将其添加到 .bashrc 或 .bash_aliases 文件来创建永久别名,如下所述:https://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash -alias
创建永久可执行别名
然后你可以只输入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

或者,如果您位于 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 .bashrcfile or (preferred) in a .bash_aliasesfile which is called from .bashrc

您可以将这些别名放在您的.bashrc文件或(首选).bash_aliases文件中,该文件从.bashrc

回答by RAJ

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

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

heroku restart

回答by matiasdim

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

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

回答by vijay chouhan

Just type the following commands from console.

只需从控制台键入以下命令。

cd /your_project
heroku restart

回答by catsby

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:

适用于 Procfile 中声明的所有进程。因此,如果您有多个 Web 进程或工作进程,每个进程都标有一个数字,您可以有选择地重新启动其中一个:

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