Skip to content

Instantly share code, notes, and snippets.

@bfritz
Created October 17, 2011 03:07

Revisions

  1. bfritz created this gist Oct 17, 2011.
    28 changes: 28 additions & 0 deletions graphite_pip_uwsgi_recipe.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # 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