Last active
December 19, 2015 01:19
-
-
Save emilisto/5875337 to your computer and use it in GitHub Desktop.
Installing Graphite on Ubuntu 12.10. Sadly, it's 2013, and this is the quickest procedure I could come up with. Special criticism goes out to the packaging of Graphite, Carbon and pycairo. Anyhow, see the `install.sh`, it's meant to read as copy-think-and-paste instructions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
graphitePort: 2003, | |
graphiteHost: "localhost", | |
port: 8125, | |
backends: [ "./backends/graphite" ] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream django { | |
server unix:/tmp/uwsgi-graphite.sock; | |
} | |
server { | |
server_name graphite-local.shootitlive.com; | |
listen 80; | |
location / { | |
include uwsgi_params; | |
uwsgi_pass django; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
vacuum = true | |
master = true | |
processes = 8 | |
pidfile = /tmp/uwsgi-graphite.pid | |
socket = /tmp/uwsgi-graphite.sock | |
chmod-socket = 666 | |
gid = graphite | |
uid = graphite | |
pythonpath = /opt/graphite/webapp | |
pymodule-alias = graphite.local_settings=/opt/graphite/webapp/graphite/local_settings.py | |
module = wsgi | |
buffer-size = 65536 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo adduser graphite | |
sudo mkdir /opt/graphite | |
sudo chown graphite:graphite /opt/graphite | |
cd /opt/graphite | |
virtualenv env | |
source env/bin/activate | |
# Download files from this gist to $(pwd) | |
pip install -r requirements.txt | |
# pip install pycairo doesn't work because "cairo doesn't use setup tools", | |
# wtf? Well, we'll just have to resort to this kind of idiocy to get a simple | |
# standard package set up. | |
pushd /tmp | |
sudo apt-get install libcairo2-dev | |
curl http://cairographics.org/releases/py2cairo-1.10.0.tar.bz2 | tar xvj | |
cd py2cairo-1.10.0 | |
./waf configure --prefix=/opt/graphite/env | |
./waf build && ./waf install | |
popd | |
pip install graphite-web carbon | |
pushd webapp/graphite | |
cp local_settings.py{.example,} | |
echo "SECRET_KEY='$(tr -dc "[:alpha:]" < /dev/urandom | head -c 15)'" >> app_settings.py | |
echo "$(cat <<EOF | |
ALLOWED_HOSTS = [ "*" ] | |
DATABASES = { | |
"default": { | |
"NAME": "/opt/graphite/storage/graphite.db", | |
"ENGINE": "django.db.backends.sqlite3" | |
} | |
} | |
EOF | |
)" > local_settings.py | |
echo "$(cat <<EOF | |
#This is the wsgi target that lives under the webapp subdirectory | |
import os, sys | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings' | |
import django.core.handlers.wsgi | |
application = django.core.handlers.wsgi.WSGIHandler() | |
EOF | |
)" > wsgi.py | |
python manage.py syncdb | |
# Answer questions and provide a default password, it will be used to login to | |
# graphite-web. | |
popd | |
pushd conf | |
cp carbon.conf{.example,} && cp storage-schemas.conf{.example,} | |
echo "$(cat <<EOF | |
[stats] | |
priority = 110 | |
pattern = .* | |
retentions = 10:2160,60:10080,600:262974 | |
EOF | |
)" >> storage-schemas.conf | |
popd | |
# This one should prolly be added to an init script of some sort if this is a | |
# production environment. | |
bin/carbon-cache.py start | |
# If you used the supervisor scripts | |
sudo supervisorctl update | |
sudo supervisorctl status | |
# Make sure statsd and graphite are running | |
# Send a count event to statsd | |
echo -n "iam.the.walrus:1|g" | nc -w 1 -u 127.0.0.1 8125 | |
# Time for test, go to the URL you configured nginx to serve graphite-web at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Django==1.5.1 | |
Twisted==13.0.0 | |
argparse==1.2.1 | |
distribute==0.6.24 | |
django-tagging==0.3.1 | |
txAMQP==0.6.2 | |
uWSGI==1.9.13 | |
whisper==0.9.10 | |
wsgiref==0.1.2 | |
zope.interface==4.0.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:graphite] | |
command=/opt/graphite/env/bin/uwsgi --ini graphite-uwsgi.ini | |
directory=/opt/graphite | |
user=graphite | |
environment=PATH="/opt/graphite/env/bin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:statsd] | |
command=statsd statsd-config.js | |
directory=/opt/graphite | |
user=graphite |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment