单个heroku应用上的多个工作人员/网络进程 [英] multiple worker/web processes on a single heroku app

查看:144
本文介绍了单个heroku应用上的多个工作人员/网络进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以配置多个worker和/或web进程以在单个Heroku应用程序容器中运行?或者这是否必须分解成多个Heroku应用?



例如:

  worker:节点capture.js 
worker:节点process.js
worker:节点purge.js
web:节点api.js
web:节点web。 js


解决方案

所有进程都必须具有唯一名称。 此外,名称 web worker 并不重要,并且没有特殊含义。唯一的如Heroku文档中所述,


过程中包含 web

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


所以你需要一个 Procfile 像这样:

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

然后,您可以分别缩放每个进程:

  $ heroku ps:scale purge = 4 


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?

For example:

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

解决方案

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:

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)

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

这篇关于单个heroku应用上的多个工作人员/网络进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆