Adding New Relic to Upstart config in Django one-click install causing 502 Error

September 28, 2015 2.1k views
Django One-Click Install Apps

Here is my Gunicorn config, with the changes I made in bold. After saving this and doing a sudo service gunicorn restart, I received a 502 error and my website is down. I’m hoping someone can help or tell me what I’m doing wrong, I have verified that all the new relic related paths included below are correct.

description "Gunicorn daemon for Django project"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectedly trigger a respawn
respawn

setuid django
setgid django
chdir /home/django

env NEW_RELIC_CONFIG_FILE=/home/django/django/dealr/newrelic.ini

exec /local/bin/newrelic-admin  run-program gunicorn \
    --name=django_project \
    --pythonpath=django_project \
    --bind=0.0.0.0:9000 \
    --config /etc/gunicorn.d/gunicorn.py \
    django_project.wsgi:application

I was trying to follow this thread.
https://www.digitalocean.com/community/questions/how-can-i-setup-new-relic-to-work-with-the-django-single-click-install-app

edited by kamaln7
1 Answer

Does /local/bin/newrelic-admin exist? The path doesn’t sound quite right. I’m guessing you’re missing the /usr part: /usr/local/bin/newrelic-admin.

You can find out exactly what the full path is by running:

which newrelic-admin

Keep in mind that you can always check the logs to see what went wrong:

less /var/log/upstart/your-service-name.log

Press G once you’ve entered less to scroll to the bottom of the file where the most recent errors go.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!