2017-07-20 102 views
0

我試圖將newrelic添加到通過dokku部署的django網站。添加newrelic到通過dokku部署的python棧(django)

我已經安裝了newrelic並添加到了需求中,並且還創建了newrelic.ini文件並添加到了回購。

我已經ASLO改變了我Procfile的命令,所以它倒像是:

NEW_RELIC_CONFIG_FILE=newrelic.ini newrelic-admin run-program gunicorn config.wsgi:application 

然而WHE我deloy我得到一個奇怪的錯誤,與守護抱怨該文件不存在:

(ticker_env) [email protected]:ticker(add_newrelic*)$ git push dokku add_newrelic:master 
Counting objects: 8, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (8/8), done. 
Writing objects: 100% (8/8), 4.21 KiB | 0 bytes/s, done. 
Total 8 (delta 3), reused 0 (delta 0) 
remote: master 
-----> Cleaning up... 
-----> Building ticker from herokuish... 
-----> Adding BUILD_ENV to build environment... 
-----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. 
     Detected buildpacks: multi nodejs python 
-----> Multipack app detected 
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-python.git 
=====> Detected Framework: Python 
-----> Installing requirements with pip 

-----> $ python manage.py collectstatic --noinput 
     DEBUG 2017-07-20 06:55:42,979 base 529 139977271977792 Configuring Raven for host: <raven.conf.remote.RemoteConfig object at 0x7f4ef31a7a90> 
     111 static files copied to '/tmp/build/staticfiles', 111 post-processed. 

     Using release configuration from last framework (Python). 
-----> Discovering process types 
     Procfile declares types -> web, tracker 
-----> Releasing ticker (dokku/ticker:latest)... 
-----> Deploying ticker (dokku/ticker:latest)... 
-----> Attempting to run scripts.dokku.predeploy from app.json (if defined) 
-----> App Procfile file found (/home/dokku/ticker/DOKKU_PROCFILE) 
-----> DOKKU_SCALE file found (/home/dokku/ticker/DOKKU_SCALE) 
=====> web=1 
=====> tracker=1 
-----> Attempting pre-flight checks 
     For more efficient zero downtime deployments, create a file CHECKS. 
     See http://dokku.viewdocs.io/dokku/deployment/zero-downtime-deploys/ for examples 
     CHECKS file not found in container: Running simple container check... 
-----> Waiting for 10 seconds ... 
644dd10a08b1186f90570d2c4186027533da19a53648c36f380f1c1ee480f04c 
remote: App container failed to start!! 
=====> ticker web container output: 
     setuidgid: fatal: unable to run NEW_RELIC_CONFIG_FILE=newrelic.ini: file does not exist 
     setuidgid: fatal: unable to run NEW_RELIC_CONFIG_FILE=newrelic.ini: file does not exist 
     setuidgid: fatal: unable to run NEW_RELIC_CONFIG_FILE=newrelic.ini: file does not exist 
     setuidgid: fatal: unable to run NEW_RELIC_CONFIG_FILE=newrelic.ini: file does not exist 
     setuidgid: fatal: unable to run NEW_RELIC_CONFIG_FILE=newrelic.ini: file does not exist 
=====> end ticker web container output 
To ideallab.org:ticker 
! [remote rejected] add_newrelic -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:ticker' 

該文件存在於回購和分支中。我需要修改buildpack以確保正確使用嗎?

回答

0

我弄明白了。

只需通過dokku將NEW_RELIC_CONFIG_FILE作爲環境變量導出,並且不要將其添加到Procfile中。在5月的情況下自動收報機是應用程序的名稱

dokku config:set ticker NEW_RELIC_CONFIG_FILE=newrelic.ini 

然後procfile是

newrelic-admin run-program gunicorn config.wsgi:application