Created
February 14, 2012 21:24
-
-
Save drawks/1830579 to your computer and use it in GitHub Desktop.
Graphite on uwsgi/nginx
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
#This is the "site config" for nginx | |
upstream django { | |
# Distribute requests to servers based on client IP. This keeps load | |
# balancing fair but consistent per-client. In this instance we're | |
# only using one uWGSI worker anyway. | |
ip_hash; | |
server unix:/tmp/uwsgi.sock; | |
} | |
server { | |
listen 8080; | |
server_name graphite; | |
charset utf-8; | |
# Django admin media. | |
location /media/admin/ { | |
alias /usr/lib/python2.7/site-packages/django/contrib/admin/media/; | |
} | |
# Your project's static media. | |
location /content/ { | |
alias /usr/share/graphite/webapp/content/; | |
} | |
# Finally, send all non-media requests to the Django server. | |
location / { | |
uwsgi_pass django; | |
include uwsgi_params; | |
} | |
} |
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
#This is the uwsgi configfile | |
[uwsgi] | |
vacuum = true | |
master = true | |
processes = 8 | |
pidfile = /tmp/uwsgi.pid | |
socket = /tmp/uwsgi.sock | |
chmod-socket = 666 | |
gid = www-data | |
uid = www-data | |
pythonpath = /usr/share/graphite/webapp | |
home = /home/drawks/graphite-sb | |
pymodule-alias = graphite.local_settings=/etc/graphite/local_settings.py | |
module = wsgi | |
buffer-size = 65536 |
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
#This is the wsgi target that lives under the webapp subdirectory | |
import os, sys | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings' | |
import django.core.handlers.wsgi | |
application = django.core.handlers.wsgi.WSGIHandler() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the point of https://gist.github.com/drawks/1830579#file-graphite-L7 when you are using 1 server? To be honest what is the point to have upstream at all?