Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fmedery/9177476 to your computer and use it in GitHub Desktop.
Save fmedery/9177476 to your computer and use it in GitHub Desktop.
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
cd
# Install dependencies
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y supervisor git python-pip apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 build-essential python3.2 python-dev libpython3.2 python3-minimal libapache2-mod-wsgi libaprutil1-ldap memcached python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 erlang-os-mon erlang-snmp rabbitmq-server bzr expect ssh libapache2-mod-python python-setuptools python-software-properties
sudo pip install django-tagging
sudo pip install zope.interface
sudo pip install 'Twisted'
sudo pip install 'Django==1.4.9'
sudo pip install txamqp
# Download graphite
wget https://github.com/graphite-project/graphite-web/archive/0.9.12.tar.gz -O graphite-web-0.9.12.tar.gz
wget https://github.com/graphite-project/carbon/archive/0.9.12.tar.gz -O carbon-0.9.12.tar.gz
wget https://github.com/graphite-project/whisper/archive/0.9.12.tar.gz -O whisper-0.9.12.tar.gz
tar -zxf graphite-web-0.9.12.tar.gz
tar -zxf carbon-0.9.12.tar.gz
tar -zxf whisper-0.9.12.tar.gz
mv graphite-web-0.9.12 graphite
mv carbon-0.9.12 carbon
mv whisper-0.9.12 whisper
rm graphite-web-0.9.12.tar.gz
rm carbon-0.9.12.tar.gz
rm whisper-0.9.12.tar.gz
# Install whisper
cd ~/whisper
sudo python setup.py install
# Install carbon
cd ~/carbon
sudo python setup.py install
cd /opt/graphite/conf
sudo cp /opt/graphite/conf/carbon.conf{.example,}
sudo cp /opt/graphite/conf/storage-schemas.conf{.example,}
#sudo vim /opt/graphite/conf/storage-schemas.conf
### Replace contents of storage-schemas.conf to be the following
#[stats]
#priority = 110
#pattern = .*
#retentions = 10:2160,60:10080,600:262974
###
####################################
# CONFIGURE GRAPHITE (webapp)
####################################
cd ~/graphite
sudo python check-dependencies.py
sudo python setup.py install
# CONFIGURE APACHE
###################
cd ~/graphite/examples
sudo cp example-graphite-vhost.conf /etc/apache2/sites-available/graphite
sudo ln -s /etc/apache2/sites-available/graphite /etc/apache2/sites-enabled/graphite
sudo cp /opt/graphite/conf/graphite.wsgi{.example,}
sudo mkdir -p /var/run/apache2
sudo vim /etc/apache2/sites-available/graphite
#####
# Change the line: WSGISocketPrefix run/wsgi
# To: WSGISocketPrefix /var/run/apache2/wsgi
#####
cd /etc/apache2/sites-available
sudo sed -i s='run/wsgi'='/var/run/apache2'=g graphite
sudo sed -i s='@DJANGO_ROOT@/contrib/admin/media/'='/usr/lib/python2.7/dist-packages/django/contrib/admin/media'=g graphite
sudo /etc/init.d/apache2 reload
####################################
# INITIAL DATABASE CREATION
####################################
cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb
# follow prompts to setup django admin user
sudo chown -R www-data:www-data /opt/graphite/storage/
cd /opt/graphite/webapp/graphite
sudo cp local_settings.py.example local_settings.py
sudo /etc/init.d/apache2 restart
####################################
# INSTALL NODEJS
####################################
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get -y install nodejs
cd /opt
sudo git clone git://github.com/etsy/statsd.git
sudo su -
cd /opt/statsd/
echo "{
graphitePort: 2003,
graphiteHost: "127.0.0.1",
port: 8125
}" > /opt/statsd/localConfig.js
####################################
# SUPERVISOR
####################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment