Tuesday, 28 August 2012

Installing Graphite on Solaris 10 from scratch leveraging OpenCSW

Some install notes on getting Graphite 0.9.10 ( http://graphite.wikidot.com ) setup on a stock Solaris 10 install using CSW. This expands a bit on the documentation here: http://graphite.wikidot.com/installation , hopefully its useful.
Note: this guide was written July-2012

# Install pkgutil / csw

# Install the required CSW pkgs
/opt/csw/bin/pkgutil -i CSWlibcairo
/opt/csw/bin/pkgutil -i CSWpython
/opt/csw/bin/pkgutil -i CSWpython-dev
/opt/csw/bin/pkgutil -i CSWgit
/opt/csw/bin/pkgutil -i CSWpycairo
/opt/csw/bin/pkgutil -i CSWapache2
/opt/csw/bin/pkgutil -i CSWpysetuptools
/opt/csw/bin/pkgutil -i CSWsqlite
/opt/csw/bin/pkgutil -i CSWpy-django
/opt/csw/bin/pkgutil -i CSWpy-zope-interface
/opt/csw/bin/pkgutil -i CSWpy-twisted
/opt/csw/bin/pkgutil -i ap2_modwsgi

# Optional
/opt/csw/bin/pkgutil -i CSWgcc3 # only necessary if you plan to rebuild components below yourself.
/opt/csw/bin/pkgutil -i CSWpy-ldap # optional

# Install PIP
/opt/csw/bin/easy_install pip

# Install Python modulues via PIP
/opt/csw/bin/pip install python-memcached
/opt/csw/bin/pip install django-tagging
/opt/csw/bin/pip install txamqp

# Now we go and get graphite itself (finally)
mkdir /tmp/graphite
cd /tmp/graphite
cd /tmp/graphite/graphite-web && /opt/csw/bin/git checkout 0.9.10
cd /tmp/graphite/carbon && /opt/csw/bin/git checkout 0.9.10
cd /tmp/graphite/whisper && /opt/csw/bin/git checkout 0.9.10

cd /tmp/graphite
pushd whisper
/opt/csw/bin/python setup.py install
popd

cd /tmp/graphite
pushd carbon
/opt/csw/bin/python setup.py install
popd

cd /tmp/graphite
pushd graphite-web
/opt/csw/bin/python setup.py install
popd

# CONFIGURE
# obviously theres lots of ways to do this, below is just a very quick way to get going.
# I strongly suggest you give this some consideration yourself.
# Worth reading through this doc:
#
cd /opt/graphite/conf
cp dashboard.conf.example dashboard.conf

cp carbon.conf.example carbon.conf
cp storage-schemas.conf.example storage-schemas.conf
cp graphite.wsgi.example graphite.wsgi
cp graphTemplates.conf.example graphTemplates.conf

cd /opt/graphite/webapp/graphite 
cp local_settings.py.example local_settings.py
EDIT: local_settings.py
SET: TIME_ZONE = 'Europe/London' (or whatever else is appropriate)

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

EDIT "/opt/csw/apache2/etc/httpd.conf" uncomment "Include etc/extra/httpd-vhosts.conf" , remove default DocumentRoot and Virtual Server for /

cat "/opt/graphite/examples/example-graphite-vhost.conf" >> /opt/csw/apache2/etc/extra/httpd-vhosts.conf
EDIT "/opt/csw/apache2/etc/extra/httpd-vhosts.conf"
CHANGE "LoadModule wsgi_module modules/mod_wsgi.so" to "LoadModule wsgi_module libexec/mod_wsgi.so"
CHANGE WSGISocketPrefix /tmp/
EDIT "/opt/graphite/webapp/graphite/settings.py" change:
- DATABASE_ENGINE = 'django.db.backends.sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
+ DATABASE_ENGINE = 'sqlite3'     # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.

# at your own risk. There are better ways to permission things
chown nobody:nobody /opt/graphite/storage/graphite.db
chmod 766 /opt/graphite/storage/log/webapp/ 
chown root:nobody /opt/graphite/storage
chmod 775 /opt/graphite/storage
chmod 775 /opt/graphite/storage/*

# enablethe webserver
svcadm enable cswapache2

# start carbon
/opt/graphite/bin/carbon-cache.py start

No comments: