Skip to content

Instantly share code, notes, and snippets.

@bryanhelmig
Forked from rw/setup-statsd.sh
Created August 10, 2012 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanhelmig/3309388 to your computer and use it in GitHub Desktop.
Save bryanhelmig/3309388 to your computer and use it in GitHub Desktop.
Turn an Ubuntu 11.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
sudo apt-get install nodejs
# install the Node package manager for later use
curl http://npmjs.org/install.sh | sudo sh
sudo npm install express
# clone the statsd project
git clone https://github.com/etsy/statsd.git
# download everything for graphite
mkdir graphite
cd graphite/
wget "http://launchpad.net/graphite/0.9/0.9.9/+download/carbon-0.9.9.tar.gz"
wget "http://launchpad.net/graphite/0.9/0.9.9/+download/whisper-0.9.9.tar.gz"
wget "http://launchpad.net/graphite/0.9/0.9.9/+download/graphite-web-0.9.9.tar.gz"
tar xzvf whisper-0.9.9.tar.gz
tar xzvf carbon-0.9.9.tar.gz
tar xzvf graphite-web-0.9.9.tar.gz
# install whisper - Graphite's DB system
cd whisper-0.9.9
sudo python setup.py install
popd
# install carbon - the Graphite back-end
cd carbon-0.9.9
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
sudo apt-get install python-django
sudo apt-get install memcached
sudo apt-get install python-memcache
sudo apt-get install python-ldap
sudo apt-get install python-twisted
sudo apt-get install apache2 libapache2-mod-python libapache2-mod-wsgi
sudo apt-get install python-django-tagging
cd ~/graphite/graphite-web-0.9.9
sudo python setup.py install
# copy the graphite vhost example to available sites, edit it to you satisfaction, then link it from sites-enabled
cd examples
sudo cp example-graphite-vhost.conf /etc/apache2/sites-available/graphite
cd /opt/graphite/conf
sudo cp graphite.wsgi.example graphite.wsgi
# Update this file with the location of the wsgi prefix
# Update this file if you installed the graphite webapp somewhere custom
sudo a2ensite graphite
service apache2 reload
# 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/
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
# run syncdb to setup the db and prime the authentication model (if you're using the DB model)
sudo python manage.py syncdb
# 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
node stats.js local.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment