Skip to content

Instantly share code, notes, and snippets.

@diyan
Last active February 1, 2017 10:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diyan/3048010 to your computer and use it in GitHub Desktop.
Save diyan/3048010 to your computer and use it in GitHub Desktop.
HOW-TO install Graphite into fully isolated Python virtual environment
## HOW-TO install Graphite into fully isolated Python virtual environment
# required for twisted binary extensions
sudo apt-get install python-dev
root=/usr/local/graphite_app
mkdir ${root} && cd ${root} && virtualenv env --prompt=\(graphite_env\)
source env/bin/activate
# NOTE that latest version of pyparsing (2.0.0) was failed to install
pip install django==1.4 django-tagging python-memcached pytz pyparsing==1.5.7 gunicorn
# Install cairocffi instead of py2cairo because it uses system cairo and much easier to install
sudo apt-get install python-dev libffi-dev
pip install cairocffi
ln -s cairocffi cairo
pip install --install-option="--prefix=$VIRTUAL_ENV" --install-option="--install-lib=$VIRTUAL_ENV/lib/python2.7/site-packages" carbon whisper
# Install graphte-web fork which can with non-rooted path
pip install --install-option="--prefix=$VIRTUAL_ENV" --install-option="--install-lib=$VIRTUAL_ENV/webapp" git+git://github.com/diyan/graphite-web.git@apache_non_root
# ensure that all required dependencies were installed
wget https://raw.github.com/graphite-project/graphite-web/master/check-dependencies.py && python check-dependencies.py
cp ${VIRTUAL_ENV}/conf/carbon.conf.example ${VIRTUAL_ENV}/conf/carbon.conf
cp ${VIRTUAL_ENV}/conf/storage-schemas.conf.example ${VIRTUAL_ENV}/conf/storage-schemas.conf
cp ${VIRTUAL_ENV}/webapp/graphite/local_settings.py.example ${VIRTUAL_ENV}/webapp/graphite/local_settings.py
local_settings=${VIRTUAL_ENV}/webapp/graphite/local_settings.py
echo "GRAPHITE_ROOT = '${VIRTUAL_ENV}/webapp/graphite'" >> $local_settings
echo "CONF_DIR = '${VIRTUAL_ENV}/conf'" >> $local_settings
echo "STORAGE_DIR = '${VIRTUAL_ENV}/storage'" >> $local_settings
echo "CONTENT_DIR = '${VIRTUAL_ENV}/webapp/content'" >> $local_settings
echo "DEBUG = True" >> $local_settings
echo "DATABASES = {'default':{'ENGINE':'django.db.backends.sqlite3', 'NAME':'/usr/local/graphite_app/env/webapp/graphite/graphite_sqlite.db'}}" >> $local_settings
cd ${VIRTUAL_ENV}/webapp/graphite
python manage.py syncdb
# uninstall all build-time dependencies
sudo apt-get remove python-dev libffi-dev && sudo apt-get autoremove
# run website
cd /usr/local/graphite_app/env/webapp && gunicorn_django --workers=1 --bind=0.0.0.0:8000
# We are using following configuration in carbon.conf instead of defaults:
# MAX_UPDATES_PER_SECOND = 50
@diyan
Copy link
Author

diyan commented Sep 19, 2013

After installation deps looks like following:

$ pip freeze

Django==1.4
Twisted==13.0.0
argparse==1.2.1
cairocffi==0.4.3
carbon==0.9.10
cffi==0.6
distribute==0.6.24
django-tagging==0.3.1
gunicorn==0.17.3
pycparser==2.09.1
pyparsing==1.5.7
python-memcached==1.48
pytz==2013b
txAMQP==0.6.2
whisper==0.9.10
wsgiref==0.1.2
zope.interface==4.0.5

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