Skip to content

Instantly share code, notes, and snippets.

@niftynei
Last active September 25, 2015 19:21
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 niftynei/27a0cf23d7141dd4d3ee to your computer and use it in GitHub Desktop.
Save niftynei/27a0cf23d7141dd4d3ee to your computer and use it in GitHub Desktop.
Setting up Graphite on an EC2 instance
# ~~Caveat Emptor~~
# This is a rough approximation of the steps I used to setup graphite on an Amazon EC2 instance
# No guarantees that it works. Also note that since you'll pulling graphite from source, there's a good possibility
# that the setup instructions have changed.
## Due diligence: many thanks are owed to the following tutorials & docs:
# https://www.digitalocean.com/community/tutorials/installing-and-configuring-graphite-and-statsd-on-an-ubuntu-12-04-vps
# https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7
# http://graphite.readthedocs.org/en/latest/releases/0_10_0.html
# https://timsvirtualworld.com/2013/05/how-to-install-graphite-on-amazon-linux/
## Finally, if you wish to set up a carbon daemon, there are instructions at the end of this tutorial:
# https://timsvirtualworld.com/2013/05/how-to-install-graphite-on-amazon-linux/
sudo yum groupinstall -y "Development tools"
sudo yum install -y /
python27-pip /
python27-devel /
mod_wsgi-python27 /
python27-pycairo-devel /
cairo /
python27-twisted /
fontconfig-devel /
fontconfig /
python27-memcached /
memcached /
python27-pyparsing /
python27-pytz /
httpd-devel /
python27-setuptools /
python27-ldap /
libffi-devel /
libxml2-python27 libxml2-devel /
pango-devel /
rrdtool-python27 /
rrdtool
sudo easy_install django-tagging zope.interface twisted txamqp
sudo vim ~/.bash_profile
# add this:
#
# export PYTHONPATH=/opt/graphite/webapp:$PYTHONPATH
# export DJANGO_SETTINGS_MODULE=graphite.settings
source ~/.bash_profile
# I had some trouble with PYTHONPATH not appearing for sudo.
# You can fix this by adding it to the sudo env with vimudo
sudo visudo
```
Defaults env_keep += "PYTHONPATH"
Defaults env_keep += "DJANGO_SETTINGS_MODULE"
```
sudo mkdir -p /usr/local/graphite
cd /usr/local/graphite
sudo git clone https://github.com/graphite-project/ceres.git
sudo git clone https://github.com/graphite-project/graphite-web.git
sudo git clone https://github.com/graphite-project/whisper.git
sudo git clone https://github.com/graphite-project/carbon.git
cd whisper/
sudo python setup.py install
cd ../carbon/
sudo python setup.py install
cd ../ceres/
sudo python setup.py install
cd ../graphite-web/
sudo pip install -r requirements.txt
sudo python check-dependencies.py
sudo python setup.py install
# setup graphite install
cd /opt/graphite/conf
sudo cp carbon.conf.example carbon.conf
sudo cp storage-schemas.conf.example storage-schemas.conf
# Edit storage-schemas.conf as you see fit
cd /opt/graphite/webapp/graphite
sudo cp local_settings.py{.example,}
sudo vim local_settings.py
# configure local_settings.
# run django setup script. this should work.
sudo /usr/local/bin/django-admin.py syncdb # --settings=graphite.settings (unnecessary b/c of DJANGO_SETTINGS)
sudo /usr/local/bin/django-admin.py collectstatic
# setup apache
sudo mkdir -p /etc/httpd/sites-available/
sudo mkdir -p /etc/httpd/sites-enabled/
sudo cp /usr/local/graphite/graphite-web/examples/example-graphite-vhost.conf /etc/httpd/sites-available/graphite.conf
sudo cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
sudo chown -R apache:apache /opt/graphite/storage
sudo mkdir -p /etc/httpd/wsgi
sudo vim /etc/httpd/sites-available/graphite.conf
# edit to… source: https://www.digitalocean.com/community/tutorials/installing-and-configuring-graphite-and-statsd-on-an-ubuntu-12-04-vps
```
...
...
WSGISocketPrefix /etc/httpd/wsgi
<VirtualHost *:80>
ServerName Your.Domain.Name.Here
...
...
```
sudo vim /etc/httpd/conf/httpd.conf
# add the following
```
Include sites-enabled/*.conf
```
# link up the graphite site
sudo ln -s /etc/httpd/sites-available/graphite.conf /etc/httpd/sites-enabled/graphite.conf
# start up carbon
sudo /opt/graphite/bin/carbon-cache.py start
sudo service httpd start
sudo chkconfig httpd on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment