Created
June 23, 2012 09:50
-
-
Save toast38coza/2977748 to your computer and use it in GitHub Desktop.
Ununtu upstart script to start django_gunicorn with New Relic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "launch django app with gunicorn and new relic monitoring" | |
start on net-device-up | |
stop on shutdown | |
respawn | |
# this cd's into your app's base dir | |
chdir /var/www/<appname>/ | |
# this sets the path to your newrelic.ini file | |
env NEW_RELIC_CONFIG_FILE=/var/www/<appname>/newrelic.ini | |
# this launches your app with gunicorn using new relic's admin tool | |
# note: in this case, /env/bin is my virtualenv. By running the command from your virtualenv's interpreter, you don't need to | |
# activate the env manually | |
exec /var/www/<appname>/env/bin/newrelic-admin run-program /var/www/<appname>/env/bin/gunicorn_django -w3 | |
Thanks a lot for this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes:
*you'll need to make a few changes to make the paths match your environment.
/etc/init/myapp.conf
then: Start:start myapp
. Stop:stop myapp
. Restartrestart myapp
(where myapp matches to
myapp.conf
)