单个heroku应用程序上的多个工作人员/ Web进程

时间:2023-01-18 19:18:21

Is there some way to configure multiple worker and/or web processes to run in the single Heroku app container? Or does this have to be broken up into multiple Heroku apps?

有没有办法配置多个工作者和/或Web进程在单个Heroku应用程序容器中运行?或者这是否必须分解为多个Heroku应用程序?

For example:

例如:

worker: node capture.js
worker: node process.js
worker: node purge.js
web: node api.js
web: node web.js

1 个解决方案

#1


34  

All processes must have unique names. Additionally, the names web and worker are insignificant and carry no special meaning. The only process that carries a significant name is the web process, as stated in the Heroku docs:

所有进程必须具有唯一的名称。此外,网站名称和工作人员都是微不足道的,没有任何特殊含义。唯一具有重要名称的流程是Web流程,如Heroku文档中所述:

The web process type is special as it’s the only process type that will receive HTTP traffic from Heroku’s routers. Other process types can be named arbitrarily. -- (https://devcenter.heroku.com/articles/procfile)

Web进程类型是特殊的,因为它是唯一将从Heroku的路由器接收HTTP流量的进程类型。其他过程类型可以任意命名。 - (https://devcenter.heroku.com/articles/procfile)

So you want a Procfile like so:

所以你想要一个这样的Procfile:

capture: node capture.js
process: node process.js
purge: node purge.js
api: node api.js
web: node web.js

You can then scale each process separately:

然后,您可以单独扩展每个进程:

$ heroku ps:scale purge=4

#1


34  

All processes must have unique names. Additionally, the names web and worker are insignificant and carry no special meaning. The only process that carries a significant name is the web process, as stated in the Heroku docs:

所有进程必须具有唯一的名称。此外,网站名称和工作人员都是微不足道的,没有任何特殊含义。唯一具有重要名称的流程是Web流程,如Heroku文档中所述:

The web process type is special as it’s the only process type that will receive HTTP traffic from Heroku’s routers. Other process types can be named arbitrarily. -- (https://devcenter.heroku.com/articles/procfile)

Web进程类型是特殊的,因为它是唯一将从Heroku的路由器接收HTTP流量的进程类型。其他过程类型可以任意命名。 - (https://devcenter.heroku.com/articles/procfile)

So you want a Procfile like so:

所以你想要一个这样的Procfile:

capture: node capture.js
process: node process.js
purge: node purge.js
api: node api.js
web: node web.js

You can then scale each process separately:

然后,您可以单独扩展每个进程:

$ heroku ps:scale purge=4