Skip to content

Instantly share code, notes, and snippets.

@canassa
Created November 1, 2012 02:06
Show Gist options
  • Save canassa/3991176 to your computer and use it in GitHub Desktop.
Save canassa/3991176 to your computer and use it in GitHub Desktop.
Installing Graphite on OS X with virtualenv

Virtualenv setup

cd /opt
sudo mkdir graphite
sudo chown `logname` graphite
virtualenv --distribute graphite
cd /opt/graphite
source bin/activate

Graphite and dependencies

Install cairo and py2cairo using brew

brew install cairo --without-x
brew install py2cairo --without-x

Since homebrew installs py2cairo in a global site-package, we need to link it in our env

ln -s /usr/local/lib/python2.7/site-packages/cairo /opt/graphite/lib/python2.7/site-packages/cairo

The other packages can be installed with pip

pip install carbon
pip install whisper
pip install django
pip install django-tagging
pip install graphite-web

Database setup

Create a /opt/graphite/webapp/graphite/local_settings.py file and add this config

DEBUG = True

DATABASES = {
   'default': {
       'NAME': '/opt/graphite/storage/graphite.db',
       'ENGINE': 'django.db.backends.sqlite3',
       'USER': '',
       'PASSWORD': '',
       'HOST': '',
       'PORT': ''
   }
}

Run syncdb to create the database

cd /opt/graphite/webapp/graphite
python manage.py syncdb

Copy the example configs

cd /opt/graphite/conf
cp storage-schemas.conf.example storage-schemas.conf
cp carbon.conf.example carbon.conf

Start the dev server

python bin/carbon-cache.py start
python bin/run-graphite-devel-server.py /opt/graphite

Now open http://localhost:8080/ If it works correclty you should see a black image with "No Data" in the Graphite Composer. If you see a broken image, it's probably something to do with py2cairo and cairo.

@mikeys
Copy link

mikeys commented Jun 5, 2013

I had to edit SECRET_KEY inside /opt/graphite/webapp/graphite/app_settings.py before running python manage.py syncdb

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