Skip to content

Instantly share code, notes, and snippets.

@ericchaves
Forked from hmmbug/graphite
Last active August 29, 2015 14:13
Show Gist options
  • Save ericchaves/fef2d36dbbaaa3f96b48 to your computer and use it in GitHub Desktop.
Save ericchaves/fef2d36dbbaaa3f96b48 to your computer and use it in GitHub Desktop.
# goes in /etc/nginx/sites-available & link in ../sites-enabled
upstream graphite {
server unix:///tmp/uwsgi.sock;
}
server {
listen 9002;
server_name localhost;
access_log /var/log/nginx/graphite-access.log;
error_log /var/log/nginx/graphite-error.log;
root /user/share/graphite/static;
location / {
add_header Access-Control-Allow-Origin "*";
add_header Access-Control-Allow-Methods "GET, OPTIONS";
add_header Access-Control-Allow-Headers "origin, authorization, accept";
uwsgi_pass graphite;
include /etc/nginx/uwsgi_params;
}
location /media {
# This makes static media available at the /media/ url. The
# media will continue to be available during site downtime,
# allowing you to use styles and images in your maintenance page.
alias /usr/lib/python2.7/dist-packages/django/contrib/admin/media;
}
}
# goes in /etc/uwsgi/apps-available & link in ../apps-enabled
[uwsgi]
vacuum = true
master = true
processes = 4
pidfile = /tmp/uwsgi.pid
socket = /tmp/uwsgi.sock
chmod-socket = 666
gid = _graphite
uid = _graphite
chdir = /usr/share/graphite-web
wsgi-file = graphite.wsgi
pymodule-alias = graphite.local_settings=/etc/graphite/local_settings.py
buffer-size = 65536
plugin = python
# install packages
sudo apt-get install graphite-carbon graphite-web python-rrdtool \
python-memcache libapache2-mod-wsgi python-psycopg python-flup \
python-sqlite python-yaml geoip-database-contrib libgdal1 \
nginx-full uwsgi uwsgi-plugin-python
# goes in /etc/default
PYTHONPATH=/usr/share/graphite-web
MODULE=graphite.wsgi
@ericchaves
Copy link
Author

On ubuntu 14.04 server I needed:

# install packages
sudo apt-get install graphite-carbon graphite-web python-rrdtool \
 python-memcache libapache2-mod-wsgi python-psycopg2 python-flup \
 python-sqlite python-yaml geoip-database-contrib libgdal1-dev \
 nginx-full uwsgi uwsgi-plugin-python postgresql libpq-dev

for initial data seup, I followed https://www.digitalocean.com/community/tutorials/how-to-install-and-use-graphite-on-an-ubuntu-14-04-server.

To generate random salt: < /dev/urandom tr -dc A-Z-a-z-0-9 | head -c${1:-64};echo;

graphite.ini needed pidfile2 insteadof pidfile so other users (like www-data) can access it.

[uwsgi]

vacuum = true
master = true
processes = 4
pidfile2 = /tmp/uwsgi.pid
socket = /tmp/uwsgi.sock
chmod-socket = 666
gid = www-data
uid = www-data
chdir = /usr/share/graphite-web
wsgi-file = graphite.wsgi
pymodule-alias = graphite.local_settings=/etc/graphite/local_settings.py
buffer-size = 65536
plugin = python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment