By Dan Olsen
I have set up a Django app with the single click installer. I am trying to get New Relic to work with the upstart script. I try adding an export line for the NEW_RELIC_CONFIG_FILE variable before the exec command in /etc/init/gunicorn and then add newrelic-admin run-program before the gunicorn command but no data flows to New Relic. If I run the same command from the command line I get it to pass data to New Relic.
Any suggestions?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
In an Upstart file, you can use an env stanza to export a variable. It would look like this using the Upstart config from the Django one-click:
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=/path/to/newrelic.ini
exec /path/to/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
Let us know how it goes!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.