单个 heroku 应用程序上的多个工作程序/网络进程
有没有办法配置多个工作进程和/或网络进程以在单个 Heroku 应用程序容器中运行?还是必须将其分解为多个 Heroku 应用程序?
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?
例如:
worker: node capture.js
worker: node process.js
worker: node purge.js
web: node api.js
web: node web.js
所有进程必须有唯一的名称.另外, 唯一有一个有意义的名字的进程是 web
和 worker
这两个名字是无关紧要的,也没有什么特殊的意义.web
过程,如 Heroku 文档中所述:
All processes must have unique names. Additionally, the names The only process that carries a significant name is the web
and worker
are insignificant and carry no special meaning.web
process, as stated in the Heroku docs:
Web 进程类型是特殊的,因为它是唯一的进程类型将从 Heroku 的路由器接收 HTTP 流量.其他工艺类型可以任意命名.-- (https://devcenter.heroku.com/articles/procfile)
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)
所以你想要一个 Procfile
像这样:
So you want a Procfile
like so:
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