Skip to content

Instantly share code, notes, and snippets.

@johnmcdowall
Forked from collegeman/setup-statsd.sh
Created June 13, 2011 21:17
Show Gist options
  • Save johnmcdowall/1023728 to your computer and use it in GitHub Desktop.
Save johnmcdowall/1023728 to your computer and use it in GitHub Desktop.
Turn an Ubuntu 10.04 Vagrant into a StatsD/Graphite server
cd ~
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
curl http://npmjs.org/install.sh | clean=yes sh
npm install express --force
# clone the statsd project
cd ~
git clone https://johnmcdowall@github.com/johnmcdowall/statsd.git
# download everything for graphite
mkdir graphite
cd graphite/
wget "http://launchpad.net/graphite/1.0/0.9.8/+download/carbon-0.9.8.tar.gz"
wget "http://launchpad.net/graphite/1.0/0.9.8/+download/whisper-0.9.8.tar.gz"
wget "http://launchpad.net/graphite/1.0/0.9.8/+download/graphite-web-0.9.8.tar.gz"
tar xzvf whisper-0.9.8.tar.gz
tar xzvf carbon-0.9.8.tar.gz
tar xzvf graphite-web-0.9.8.tar.gz
# install whisper - Graphite's DB system
cd whisper-0.9.8
sudo python setup.py install
cd ..
# install carbon - the Graphite back-end
cd carbon-0.9.8
sudo python setup.py install
cd /opt/graphite/conf
sudo cp carbon.conf.example carbon.conf
# copy the example schema configuration file, and then configure the schema
# see: http://graphite.wikidot.com/getting-your-data-into-graphite
sudo cp storage-schemas.conf.example storage-schemas.conf
# install other graphite dependencies
sudo apt-get install python-cairo --force-yes -y
sudo apt-get install python-django --force-yes -y
sudo apt-get install memcached --force-yes -y
sudo apt-get install python-memcache --force-yes -y
sudo apt-get install python-ldap --force-yes -y
sudo apt-get install python-twisted --force-yes -y
sudo apt-get install apache2 libapache2-mod-python --force-yes -y
sudo apt-get install libapache2-mod-wsgi --force-yes -y
cd ~/graphite/graphite-web-0.9.8
sudo python setup.py install
cd /opt/graphite/conf
sudo cp graphite.wsgi.example graphite.wsgi
# copy the graphite vhost example to available sites, edit it to you satisfaction, then link it from sites-enabled
cd ~/graphite/graphite-web-0.9.8/examples
sudo cp example-graphite-vhost.conf /etc/apache2/sites-available/graphite.conf
sudo ln -s /etc/apache2/sites-available/graphite.conf /etc/apache2/sites-enabled/graphite.conf
cd /etc/apache2
sudo rm ports.conf
sudo sh -c "echo 'NameVirtualHost *:8300\nListen 8300' > ports.conf"
sudo rm httpd.conf
sudo sh -c "echo 'LoadModule python_module modules/mod_python.so' > httpd.conf"
cd sites-available/
sudo sh -c "sed 's/80/8300/g' graphite.conf > TEMPFILE && mv TEMPFILE graphite.conf"
# I had to create these log files manually
cd /opt/graphite/storage/log/webapp
sudo touch info.log
sudo chmod 777 info.log
sudo touch exception.log
sudo chmod 777 exception.log
# make sure to change ownership of the storage folder to the Apache user/group - mine was www-data
sudo chown -R www-data:www-data /opt/graphite/storage/
sudo a2enmod wsgi && sudo invoke-rc.d apache2 restart
# run syncdb to setup the db and prime the authentication model (if you're using the DB model)
cd /opt/graphite/webapp/graphite
# copy the local_settings example file to creating the app's settings
# this is where both carbon federation and authentication is configured
sudo cp local_settings.py.example local_settings.py
sudo python manage.py syncdb
sudo chown -R www-data:www-data /opt/graphite/storage/
# start the carbon cache
sudo /opt/graphite/bin/carbon-cache.py start
# copy the the statsd config example to create the config file
# unless you used non-default ports for some other feature of the system, the defaults in the config file are fine
cd ~/statsd
cp exampleConfig.js local.js
# start statsd
sudo node stats.js local.js 2>&1 >> ~/node.log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment