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
@hyfather
Copy link

hyfather commented May 9, 2013

Thanks, this helped!

@nilesh1013
Copy link

Nice and precious it is

@mouadh1234
Copy link

Hi, i have a problem when i write this command (cd /opt/graphite/webapp/graphite; python manage.py syncdb)
i get this error
File "manage.py", line 5, in
from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

i try this
sudo apt-get install git apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapache2-mod-wsgi libaprutil1-ldap memcached python-cairo python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 erlang-os-mon erlang-snmp rabbitmq-server bzr expect ssh python-setuptools python-dev python-pip libcairo2 libcairo2-dev --yes

sudo pip install --upgrade pip

cat >> /tmp/graphite_reqs.txt << EOF
django==1.3
python-memcached
django-tagging
twisted
whisper==0.9.10
carbon==0.9.10
graphite-web==0.9.10
EOF

sudo pip install -r /tmp/graphite_reqs.txt
but still the some probleme

@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