Skip to content

Instantly share code, notes, and snippets.

@mojowen
Forked from recamshak/gist:4124194
Last active December 21, 2015 13:29
Show Gist options
  • Save mojowen/6313088 to your computer and use it in GitHub Desktop.
Save mojowen/6313088 to your computer and use it in GitHub Desktop.
setting up graphit / statsd on webfaction
# this script will install whisper, carbon and graphite-web on the current directory
# Modified to reflect current WebFaction python best practices
mkdir -p $HOME/lib/python2.7
# Follow steps here http://theneum.com/blog/webfaction-virtualenv-how-to/
easy_install-2.7 pip
pip-2.7 install virtualenvwrapper
mkdir ~/.virtualenvs
vim ~/.bash_profile
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_TMPDIR=$HOME/.virtualenvs/tmp
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
source $HOME/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
# Reload terminal to get new .bash_profile
pip-2.7 install twisted
pip-2.7 install django
pip-2.7 install django-tagging
pip-2.7 install gunicorn
pip-2.7 install whisper
mkvirtualenv --system-site-packages graphite
SITE_PACKAGE=`virtualenvwrapper_get_site_packages_dir`
DIR=`pwd`
pip-2.7 install carbon --install-option="--prefix=$DIR" --install-option="--install-lib=$SITE_PACKAGE"
pip-2.7 install graphite-web --install-option="--prefix=$DIR" --install-option="--install-lib=$SITE_PACKAGE"
export PKG_CONFIG_PATH=$HOME/lib/pkgconfig
export LD_LIBRARY_PATH=$HOME/lib
# install pycairo dependencies
wget http://www.cairographics.org/releases/pixman-0.28.0.tar.gz
tar -xzf pixman-0.28.0.tar.gz
cd pixman-0.28.0
./configure --prefix=$HOME
make
make install
cd ..
wget http://www.cairographics.org/releases/cairo-1.12.8.tar.xz
tar -xJf cairo-1.12.8.tar.xz
cd cairo-1.12.8
./configure --prefix=$HOME
make
make install
cd ..
wget http://www.cairographics.org/releases/py2cairo-1.10.0.tar.bz2
tar -xjf py2cairo-1.10.0.tar.bz2
cd py2cairo-1.10.0
./waf configure --prefix=$VIRTUAL_ENV
./waf build
./waf install
cd ..
rm -rf cairo-1.12.8*
rm -rf pixman-0.28.0*
rm -rf py2cairo-1.10.0*
# configure graphite-web paths
GRAPHITE_WEB_SETTINGS=$SITE_PACKAGE/graphite/local_settings.py
cp $GRAPHITE_WEB_SETTINGS{.example,}
cat >> $GRAPHITE_WEB_SETTINGS <<EOF
GRAPHITE_ROOT = '$DIR'
CONF_DIR = GRAPHITE_ROOT + '/conf'
STORAGE_DIR = GRAPHITE_ROOT + '/storage'
CONTENT_DIR = GRAPHITE_ROOT + '/webapp/content'
DATABASES = {
'default': {
'NAME': GRAPHITE_ROOT + '/storage/graphite.db',
'ENGINE': 'django.db.backends.sqlite3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
}
}
EOF
# run syncdb - this didn't work...
django-admin.py syncdb --settings graphite.settings
# And then what...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment