← Back to team overview

graphite-dev team mailing list archive

[Question #184134]: Quick install instructions using virtualenv

 

New question #184134 on Graphite:
https://answers.launchpad.net/graphite/+question/184134

http://drewp.quickwitretort.com/2012/01/08/0 is my blog post about how I did a local run of graphite using virtualenv (on ubuntu, if it matters).

I'll paste the text here to help searches, but the formatting is probably better on my own page.

---------------------------------------------------------------------------

Here's how to start from a linux box with python 2.7 and virtualenv, and end up with a running graphite web server and data collector daemon (carbon-cache). I use supervisord and nginx as well, but you don't need exactly those to make the setup work.

mkdir /new/dir
cd /new/dir
 
Fetch software
virtualenv .

bin/easy_install "gunicorn==0.13.4"
bin/easy_install "Django==1.3.1"
bin/easy_install "graphite_web==0.9.9"
bin/easy_install "carbon==0.9.9"
bin/easy_install "whisper==0.9.9"
bin/easy_install http://django-tagging.googlecode.com/files/django-tagging-0.3.1.tar.gz
Setup configs
cp ./lib/python2.7/site-packages/carbon-0.9.9-py2.7.egg/conf/carbon.conf.example ./carbon.conf
echo "TIME_ZONE = 'America/Los_Angeles'" > local_settings.py
ln -s ../../../../../local_settings.py ./lib/python2.7/site-packages/graphite_web-0.9.9-py2.7.egg/graphite/local_settings.py
mkdir -p storage/log/webapp
 
Run this once to init a sqlite database

GRAPHITE_STORAGE_DIR=storage/ DJANGO_SETTINGS_MODULE=graphite.settings bin/django-admin.py syncdb

It will say "you don't have any superusers defined. Would you like to create one now?" Say yes and put add minimal information. I'm not sure where this information ever shows up again.
Run these two daemons
GRAPHITE_CONF_DIR=. GRAPHITE_ROOT=. bin/carbon-cache.py --debug start

GRAPHITE_STORAGE_DIR=storage/
 bin/gunicorn_django -b 0.0.0.0:9037 
./lib/python2.7/site-packages/graphite_web-0.9.9-py2.7.egg/graphite/settings.py

Here's a config for supervisord that runs those lines:

[program:graphite_carbon_2003]
directory=/opt/graphite/0.9.9
environment=GRAPHITE_CONF_DIR=.,GRAPHITE_ROOT=. 
command=/opt/graphite/0.9.9/bin/carbon-cache.py --debug start
# --debug needed for fg mode, but now it logs every datapoint operation
stdout_logfile=/dev/null

[program:graphite_9037]
directory=/opt/graphite/0.9.9
environment=GRAPHITE_STORAGE_DIR=storage/
command=/opt/graphite/0.9.9/bin/gunicorn_django
 -b 0.0.0.0:9037 
./lib/python2.7/site-packages/graphite_web-0.9.9-py2.7.egg/graphite/settings.py

Serve the web page
Set your web server to proxy http://something.example.com/ to localhost:9037. The graphite pages are full of /root addresses, so it's very hard to serve graphite from anywhere but the top of its own (sub)domain. Serve http://something.example.com/content from the static files at ./lib/python2.7/site-packages/graphite_web-0.9.9-py2.7.egg/webapp/content 

Here's an example config for nginx:

server { 
  server_name graphite.example.com ; 
  location / { 
    proxy_pass http://localhost:9037/; 
  } 
  location /content {
    root /opt/graphite/0.9.9/lib/python2.7/site-packages/graphite_web-0.9.9-py2.7.egg/webapp;
  }
}
 
Add data
To track the number of files in your home dir over time, run this in a loop or cron:
echo demo.numFiles `ls -1 ~ | wc -l` `date +%s` | nc -q 0 localhost 2003
Galena is a python module that does the same thing.

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.