Skip to content

Instantly share code, notes, and snippets.

@cybo42
Created March 4, 2013 16:21
Show Gist options
  • Select an option

  • Save cybo42/5083430 to your computer and use it in GitHub Desktop.

Select an option

Save cybo42/5083430 to your computer and use it in GitHub Desktop.

Revisions

  1. cybo42 created this gist Mar 4, 2013.
    38 changes: 38 additions & 0 deletions graphite.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    NameVirtualHost *:80

    # You may need to manually edit this file to fit your needs.
    # This configuration assumes the default installation prefix
    # of /opt/graphite/, if you installed graphite somewhere else
    # you will need to change all the occurances of /opt/graphite/
    # in this file to your chosen install location.

    <VirtualHost *:80>
    # ServerName graphite
    DocumentRoot "/opt/graphite/webapp"
    ErrorLog /opt/graphite/storage/log/webapp/error.log
    CustomLog /opt/graphite/storage/log/webapp/access.log common

    <Location "/">
    SetHandler python-program
    PythonPath "['/opt/graphite/webapp'] + ['/usr/local/lib/python2.6/dist-packages/'] + sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE graphite.settings
    PythonDebug Off
    PythonAutoReload Off
    </Location>

    <Location "/content/">
    SetHandler None
    </Location>

    <Location "/media/">
    SetHandler None
    </Location>

    # NOTE: In order for the django admin site media to work you
    # must change @DJANGO_ROOT@ to be the path to your django
    # installation, which is probably something like:
    # /usr/lib/python2.6/site-packages/django
    Alias /media/ "/usr/lib/python2.4/site-packages/django/contrib/admin/media/"

    </VirtualHost>
    93 changes: 93 additions & 0 deletions setup-statsd-centos.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    # First do a fresh install of CentOS 5.7 i386, server configuration (no GUI)
    # This should be performed as root since it's going to be installing a bunch of stuff

    # --- Update things to make sure we have the latest patches ---
    # Add EPEL so we can get reasonably recent packages
    rpm -Uvh "http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm"
    yum update # This takes quite a while for a fresh install

    # --- Install Whisper - Graphite's DB system ---
    wget "http://launchpad.net/graphite/0.9/0.9.7/+download/whisper-0.9.7-1.noarch.rpm"
    rpm -Uvh whisper-0.9.7-1.noarch.rpm
    rm -rf whisper*.rpm

    # -- Install Carbon - the Graphite back-end ---
    wget "http://launchpad.net/graphite/0.9/0.9.7/+download/carbon-0.9.7-1.noarch.rpm"
    rpm -Uvh carbon-0.9.7-1.noarch.rpm
    cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
    cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
    rm -rf carbon*.rpm

    # --- Install Graphite dependencies ---
    yum install -y pycairo mod_python Django python-ldap python-memcached python-sqlite2 \
    bitmap bitmap-fonts python-devel python-crypto pyOpenSSL zope gcc

    # --- Install Twisted ---
    wget http://pypi.python.org/packages/source/T/Twisted/Twisted-11.0.0.tar.bz2
    tar jxf Twisted-11.0.0.tar.bz2
    pushd Twisted-11.0.0
    python setup.py install
    popd
    rm -rf Twisted-11.0.0*

    # --- Install Graphite ---
    wget "http://launchpad.net/graphite/0.9/0.9.7/+download/graphite-web-0.9.7c-1.noarch.rpm"
    rpm -Uvh graphite-web-0.9.7c-1.noarch.rpm
    rm -rf graphite-web*.rpm

    # ===== BEGIN MANUAL STEP =====
    # Populate /etc/httpd/conf.d/graphite.conf with the included file
    # Edit /etc/sysconfig/selinux to set the SELINUX line to:
    # SELINUX=permissive
    system-config-securitylevel
    # Go to firewall settings and put 8125:udp in the "other" box
    # ===== END MANUAL STEP =====

    # --- Configure Graphite ---
    # get SELinux out of the way
    setenforce 0
    service httpd restart
    # change ownership of the storage folder to the Apache user/group
    chown -R apache:apache /opt/graphite/storage/
    # copy the local_settings example file to creating the app's settings
    # this is where both carbon federation and authentication is configured
    cp /opt/graphite/webapp/graphite/local_settings.py.example \
    /opt/graphite/webapp/graphite/local_settings.py

    # ===== BEGIN MANUAL STEP =====
    # run syncdb to setup the db and prime the authentication model (if you're using the DB model)
    python /opt/graphite/webapp/graphite/manage.py syncdb
    # ===== END MANUAL STEP =====

    # start the carbon cache
    PYTHONPATH=/usr/local/lib/python2.6/dist-packages/ /opt/graphite/bin/carbon-cache.py start

    # --- Install git ---
    yum install -y gcc zlib-devel curl curl-devel openssl
    wget http://kernel.org/pub/software/scm/git/git-1.7.4.2.tar.bz2
    tar xjf git-1.7.4.2.tar.bz2
    pushd git-1.7.4.2
    ./configure && make && make install
    popd
    rm -rf git*

    # --- Install NodeJS ---
    yum install -y gcc-c++
    git clone https://github.com/joyent/node.git
    pushd node
    ./configure && make && make install
    popd
    rm -rf node

    # --- Install the Node Package Manager ---
    curl http://npmjs.org/install.sh | sh
    npm install express

    # --- Install StatsD ---
    git clone https://github.com/etsy/statsd.git
    cd statsd
    # 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
    cp exampleConfig.js local.js
    # --- Start StatsD ---
    node stats.js local.js