Procfile在哪里?

时间:2012-11-10 15:27:15

标签: heroku

我正在尝试安装New Relic,但它说我需要对Procfile进行更改。我似乎无法在我的应用程序的本地副本的根目录中找到它。我正在使用Django。

由于

2 个答案:

答案 0 :(得分:0)

Heroku上的这个页面提供了有关procfile的更多信息: https://devcenter.heroku.com/articles/procfile

您不必有一个部署到Heroku,但您可以手动创建一个以更好地控制Heroku如何运行您的应用程序。根据以上链接的摘录:

  

部署以Heroku支持的大多数语言编写的应用程序不需要Procfile。平台自动检测语言,并创建默认Web进程类型以引导应用程序服务器。

     

建议您创建一个显式的Procfile,以便更好地控制和灵活应用。

     

要让Heroku使用您的Procfile,请将Procfile添加到应用程序的根目录,推送到Heroku:

$ git add .
$ git commit -m "Procfile"
$ git push heroku
...
-----> Procfile declares process types: web, worker
       Compiled slug size is 10.4MB
-----> Launching... done
       http://strong-stone-297.herokuapp.com deployed to Heroku

To git@heroku.com:strong-stone-297.git
 * [new branch]      master -> master

答案 1 :(得分:0)

对于New Relic支持,你必须明确地告诉Heroku在New Relic中运行一个gunicorn实例。所以你的Procfile看起来像这样:

newrelic-admin run-program gunicorn --workers 4 --worker-class gevent --timeout 60 mysite.wsgi

您可以通过在Heroku环境变量中有条件地查找New Relic许可证而无需更改Procfile来打开或关闭此功能:

Procfile:
    web: bash scripts/heroku_run
scripts/heroku_run:
    #!/bin/bash

    run_command="gunicorn --workers 4 --worker-class gevent --timeout 60 mysite.wsgi"

    # Run through New Relic monitoring if add-on installed
    if [[ $NEW_RELIC_LICENSE_KEY != '' ]]; then
        newrelic-admin run-program $run_command
    else
        $run_command
    fi
相关问题