-
-
Save bhang/2703599 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# node.js using PPA (for statsd) | |
sudo apt-get install python-software-properties | |
sudo apt-add-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs npm | |
# Install git to get statsd | |
sudo apt-get install git | |
# System level dependencies for Graphite | |
sudo apt-get install memcached python-dev python-pip sqlite3 libcairo2 \ | |
libcairo2-dev python-cairo pkg-config | |
# Get latest pip | |
sudo pip install --upgrade pip | |
# Install carbon and graphite deps | |
cat >> /tmp/graphite_reqs.txt << EOF | |
django==1.3 | |
python-memcached | |
django-tagging | |
twisted | |
whisper==0.9.9 | |
carbon==0.9.9 | |
graphite-web==0.9.9 | |
EOF | |
sudo pip install -r /tmp/graphite_reqs.txt | |
# | |
# Configure carbon | |
# | |
cd /opt/graphite/conf/ | |
sudo cp carbon.conf.example carbon.conf | |
# Create storage schema and copy it over | |
# Using the sample as provided in the statsd README | |
# https://github.com/etsy/statsd#graphite-schema | |
cat >> /tmp/storage-schemas.conf << EOF | |
# Schema definitions for Whisper files. Entries are scanned in order, | |
# and first match wins. This file is scanned for changes every 60 seconds. | |
# | |
# [name] | |
# pattern = regex | |
# retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ... | |
[stats] | |
priority = 110 | |
pattern = ^stats\..* | |
retentions = 10s:6h,1m:7d,10m:1y | |
EOF | |
sudo cp /tmp/storage-schemas.conf storage-schemas.conf | |
# Make sure log dir exists for webapp | |
sudo mkdir -p /opt/graphite/storage/log/webapp | |
# Copy over the local settings file and initialize database | |
cd /opt/graphite/webapp/graphite/ | |
sudo cp local_settings.py.example local_settings.py | |
sudo python manage.py syncdb # Follow the prompts, creating a superuser is optional | |
# statsd | |
cd /opt && sudo git clone git://github.com/etsy/statsd.git | |
# StatsD configuration | |
cat >> /tmp/localConfig.js << EOF | |
{ | |
graphitePort: 2003 | |
, graphiteHost: "127.0.0.1" | |
, port: 8125 | |
} | |
EOF | |
sudo cp /tmp/localConfig.js /opt/statsd/localConfig.js | |
thank you very much.
Awesome, thank you! Worked perfectly!
Installed it successfully. How to start statsd and graphite?
Just run:
sudo /opt/graphite/bin/carbon-cache.py
You could also add a </dev/null at the end of the apt-add-repository command:
sudo apt-add-repository ppa:chris-lea/node.js </dev/null
Just a heads up: when running the script above from a stock install of Ubuntu 12.04, make sure to run sudo apt-get update
before sudo apt-get install python-software-properties
, otherwise the latter will fail.
Also, "As of Node.js v0.10.0, the nodejs package from Chris Lea's repo includes both npm and nodejs-dev," so no need to apt-get install npm
.
Hey! Thanks for the script... a newbie question: How can I put that in init? I want it to start with the system.
Thanks
@Gmagella use Ubuntu upstart
For those that have a twisted daemonize import error see: http://stackoverflow.com/questions/19894708/cant-start-carbon-12-04-python-error-importerror-cannot-import-name-daem
ubuntu-12.04.4-server-amd64 - fresh installation:
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 438, in execute_manager
[... a lot of...]
ImportError: cannot import name python_2_unicode_compatible
Any suggestions?
@czaban change /tmp/graphite_reqs.txt to be django-tagging==0.3.1
@czaban thanks! i had to reinstall with the django-tagging version but it worked
So far, on Ubuntu 14.04:
- Installed Django 1.5 (clears
cannot import name python_2_unicode_compatible
error) sudo vim /opt/graphite/webapp/graphite/settings.py
- set theSECRET_KEY
to something.
Set a database in local_settings.py
.
Error received during sudo python manage.py syncdb
:
ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
Anyone know of an example of 14.04? I'm running out of time to track all the various dependencies :D
Edit: This might be the ticket - on 14.04, there appears to be an apt package.
I try install on this vagrant - https://github.com/irmantas/symfony2-vagrant and have error
vagrant@precise64:/opt/graphite/webapp/graphite$ sudo python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 219, in execute
self.validate()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 36, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 146, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/opt/graphite/webapp/graphite/events/models.py", line 10, in
from tagging.fields import TagField
File "/usr/local/lib/python2.7/dist-packages/tagging/fields.py", line 9, in
from .models import Tag
File "/usr/local/lib/python2.7/dist-packages/tagging/models.py", line 6, in
from django.utils.encoding import smart_text
ImportError: cannot import name smart_text
I got the exact same error as the commenter above. Anybody got a solution?
Trying to install on Ubuntu 14.04 X64
Thank you very much for this, made my day easier :)