multiple worker/web processes on a single heroku app

前端 未结 1 1225
抹茶落季
抹茶落季 2020-12-02 20:35

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?

相关标签:
1条回答
  • 2020-12-02 20:41

    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
    
    0 讨论(0)
提交回复
热议问题