Skip to content

Instantly share code, notes, and snippets.

@bohde
Forked from bfritz/graphite_pip_uwsgi_recipe.sh
Created November 28, 2011 18:08
Show Gist options
  • Save bohde/1401354 to your computer and use it in GitHub Desktop.
Save bohde/1401354 to your computer and use it in GitHub Desktop.
installing graphite-web with pip and running under uwsgi
# graphite-web install is hardcoded in setup.cfg to /opt/graphite
sudo mkdir /opt/graphite
sudo chown brad.users /opt/graphite
# run under python2.7 virtualenv
virtualenv --python=python2.7 ~/ve/graphite
source ~/ve/graphite/bin/activate
# install the necessary python packages (simplejson is for flot graphs)
pip install graphite-web carbon whisper django django-tagging uwsgi simplejson
# use example configurations
cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
# feed carbon 1000 random data points at 90 second intervals
perl -e '$ts = time(); for (1..1000) { printf "foo.bar %d %d\n", int(rand(10000)), $ts - 90 * $_ }' \
| nc -c localhost 2003
# make sure the database gets created
(cd /opt/graphite/webapp/graphite; python manage.py syncdb)
# start graphite-web under uwsgi using built-in http server on port 8085
$HOME/ve/graphite/bin/uwsgi --http localhost:8085 --master --processes 4 --home $HOME/ve/graphite --pythonpath /opt/graphite/webapp/graphite --wsgi-file=/opt/graphite/conf/graphite.wsgi.example
# view a graph of the random data
firefox http://localhost:8085/render/?width=800&height=600&target=foo.bar
@hasoffers-tamome
Copy link

@mouadh1234
i run it with sudo:
cd /opt/graphite/webapp/graphite
sudo python manage.py syncdb

but now have:
File "/opt/graphite/conf/graphite.wsgi.example", line 5, in
import django.core.handlers.wsgi
when am calling:
uwsgi --http localhost:8085 --master --processes 4 --home $HOME/ve/graphite --pythonpath /opt/graphite/webapp/graphite --wsgi-file=/opt/graphite/conf/graphite.wsgi.example

any ideas?

@ryzzn
Copy link

ryzzn commented Mar 10, 2016

Thanks very much. It helps me solve the problem of starting uwsgi.

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