Skip to content

Instantly share code, notes, and snippets.

@ebuildy
Created December 11, 2014 15:20
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 ebuildy/44a9fb541b3c5d49ca70 to your computer and use it in GitHub Desktop.
Save ebuildy/44a9fb541b3c5d49ca70 to your computer and use it in GitHub Desktop.
install_graphite
#!/bin/sh
### BEGIN INIT INFO
# Provides: carbon
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Carbon
# Description: Carbon interface for Whisper storage.
### END INIT INFO
# Author: Mathieu Lecarme <mlecarme@bearstech.com>
/opt/graphite/bin/carbon-cache.py $1
#!/bin/sh
### BEGIN INIT INFO
# Provides: graphite
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Graphite
# Description: Graphite web frontend.
### END INIT INFO
# Author: Mathieu Lecarme <mlecarme@bearstech.com>
PIDFILE=/opt/graphite/storage/graphite.pid
DAEMON=/opt/graphite/bin/gunicorn_django
HOST=0.0.0.0
PORT=8000
USER=graphite
HOME=/opt/graphite/webapp/graphite
WORKERS=4
case "$1" in
start)
cd $HOME && $DAEMON --pid $PIDFILE -b $HOST:$PORT --daemon --user $USER --workers $WORKERS
;;
stop)
kill -9 `cat $PID`
;;
*)
echo "Usage: graphite {start|stop}" >&2
exit 3
;;
esac
uwsgi \
--virtualenv /opt/graphite \
--pythonpath /opt/graphite/webapp/graphite \
--wsgi-file=/opt/graphite/conf/graphite.wsgi \
--socket /tmp/graphite_a.sock \
--pidfile /tmp/graphite_a.pid \
--daemonize /var/log/uwsgi/graphite_a.log \
--socket-timeout 20 \
--processes 2
#!/bin/bash
sudo apt-get install nginx
sudo apt-get install python-virtualenv gcc python-dev
sudo apt-get install python-pip
sudo mkdir -p /opt/graphite
sudo virtualenv --no-site-packages /opt/graphite
sudo source /opt/graphite/bin/activate
sudo pip install whisper
sudo pip install carbon
sudo pip install graphite-web
cd /opt/graphite/conf/
sudo cp carbon.conf.example carbon.conf
sudo cp storage-schemas.conf.example storage-schemas.conf
sudo adduser --disabled-password --quiet --system --home /opt/graphite graphite
sudo chown -R graphite /opt/graphite
pip install django
pip install django-tagging
cd /opt/graphite/webapp/graphite
sudo cp local_settings.py.example local_settings.py
sudo python manage.py syncdb
sudo apt-get install python-cairo
sudo ln -s /usr/lib/python2.7/cairo /opt/graphite/lib/python2.7/site-packages
sudo pip install gunicorn
server {
listen 80;
server_name
graphite.example.com
;
error_log /var/log/uwsgi/graphite_a-nginx.log
location / {
auth_basic "Graphite";
auth_basic_user_file /etc/nginx/_htpasswd/graphite ;
include /etc/nginx/uwsgi_params;
uwsgi_pass unix:///tmp/graphite_a.sock;
uwsgi_param SCRIPT_NAME /;
uwsgi_intercept_errors on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment