A quick and dirty way to package Graphite using fpm and a custom target. Please read the instructions inside, it was never meant to be shared and is mostly tailored for my own needs. One of them being debian/Ubuntu. However fpm supports many, many other package managers so the script can be easily adopted. The resulting package does NOT contain …
#!/bin/bash | |
# A quick and dirty way to package Graphite using fpm and a custom target. | |
# (c) by Hynek Schlawack, MIT licence, USE AT OWN RISK. | |
# EXECUTE DIRECTLY ON A BUILDBOT -- IT USES REAL PATHS SINCE GRAPHITE IS PRICKY | |
# Necessary Ubuntu dependency for building: build-essential, libcairo-dev and | |
# fpm which isn't packaged unfortunately: https://github.com/jordansissel/fpm | |
############################################################################### | |
# | |
# CUSTOMIZE ME HERE | |
# | |
# Your destination directory where you want to keep your graphite installation. | |
# Should be cleared before running. I use a rm -rf for it but since nobody ever | |
# reads docs, I commented it out. | |
BUILD=/home/graphite | |
# Uncomment this AFTER you understood what and why it does | |
# rm -rf $BUILD | |
# The prefix to use for your package. If none, the package will be just called | |
# "graphite". | |
# PKG_PREFIX= | |
# Version of your finished graphite package. | |
VERSION=1 | |
# Current Py2Cairo version, will be automatically fetched. | |
PYCAIROVERSION=1.10.0 | |
# END OF CUSTOMIZATION | |
# | |
############################################################################### | |
pushd . | |
virtualenv $BUILD | |
cd $BUILD | |
. bin/activate | |
# Install all deps | |
pip install whisper Django django-tagging python-memcached uWSGI | |
pip install carbon --install-option="--prefix=$BUILD" --install-option="--install-lib=$BUILD/lib/python2.7/site-packages/" | |
pip install graphite-web --install-option="--prefix=$BUILD" --install-option="--install-lib=$BUILD/webapp" | |
# Py2Cairo is a bitch | |
mkdir tmp | |
cd tmp | |
wget http://www.cairographics.org/releases/py2cairo-$PYCAIROVERSION.tar.bz2 | |
tar xf py2cairo-$PYCAIROVERSION.tar.bz2 | |
cd py2cairo-$PYCAIROVERSION | |
./waf configure --prefix=$BUILD | |
./waf build | |
./waf install | |
cd ../.. | |
rm -rf tmp | |
# kill superflous files | |
rm -rf examples conf/* webapp/graphite/local_settings.py.example | |
popd | |
# build the package | |
fpm -s dir -t deb -n ${PKG_PREFIX}graphite -v $VERSION -a all \ | |
-d memcached -d supervisor -d libcairo2 \ | |
--after-install postinst $BUILD |
[program:carbon] | |
command=/home/graphite/bin/carbon-cache.py --debug start | |
user=graphite | |
directory=/home/graphite | |
[program:graphite-web] | |
command=/home/graphite/bin/uwsgi conf/uwsgi.ini | |
user=graphite | |
directory=/home/graphite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment