Graphite and Nginx with uwsgi (2015 version)

A few years back, I wrote this tutorial to install Graphite with uwsgi on Debian. At the time, I used uwsgi 0.9.9 which has since evolved. My current Debian Jessie uses packages available from the system rather than having to use tarballs. It is now provided as version 2.0.7

Needless to say it has changed quite a bit. I have spent some time configuring it right and eventually got it. For posterity, here’s the config I now use, the rest of the configuration is still pretty much valid from the previous post.

Install the following packages: uwsgi uwsgi-core uwsgi-plugin-python
Create a file called graphite.ini in /etc/uwsgi/apps-available/ then copy the following into it, and symlink it to apps-enabled.

[uwsgi]
processes = 2
uid = www-data
gid = www-data
chdir = /opt/graphite/webapp
pythonpath = "['/opt/graphite/webapp'] + sys.path"
manage-script-name = true
mount = /graphite=/opt/graphite/conf/graphite.wsgi
socket = 127.0.0.1:3031

Restart the uwsgi service and check the logs, they should get created in /var/log/uwsgi/app/graphite.log by default.