Foreman: Use different Procfile in development and production

前端 未结 4 442
抹茶落季
抹茶落季 2020-12-23 02:28

I have a homemade Sinatra application for which I intend to use Heroku to host it.

I use foreman and shotgun in development, with the following Procfile:

<         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-23 02:39

    Here is a way to handle it with one Procfile and environment variables. I am using this on Heroku.

    Set your environment:

    export WEB_START_COMMAND='node index.js'
    export WORKER_START_COMMAND='node worker.js'
    

    The Procfile:

    web: eval '$WEB_START_COMMAND'
    worker: eval '$WORKER_START_COMMAND'
    

    Export different start command in your server and dev environments.

提交回复
热议问题