Saturday, May 5, 2012

statsd With nodejs On FreeBSD

Getting statsd to run on FreeBSD 8.2 was a breeze!

nodejs

$ sudo portmaster www/node

statsd

$ curl -C - -L -o statsd.zip https://github.com/etsy/statsd/zipball/master
$ unzip statsd.zip
$ mv <statsd unzip> statsd
$ cd statsd
$ cp exampleConfig.js yourmachineConfig.js
$ vi yourmachineConfig.js
$ node stats.js yourmachineConfig.js

supervisord Entry

[program:statsd]
command=/usr/local/bin/node stats.js yourmachineConfig.js
directory=/path/to/statsd/
user=someuser
autostart=true
autorestart=true

Good luck!

Thursday, May 3, 2012

supervisor Entries For Graphite

TLDR

Below are entries for supervisor to start carbon and Graphite. I found some hints from this file on bitbucket.

supervisord.conf

[program:x] entries.

[program:graphite]
; django gunicorn instance for graphite
command=/home/someuser/devel/graphite/bin/gunicorn_django --config=/home/someuser/devel/graphite/etc/gunicorn.py --pid=/home/someuser/devel/graphite/var/gunicorn.pid webapp/graphite/
environment=PYTHONPATH="/home/someuser/devel/graphite"
user=someuser
autostart=true
autorestart=true
directory=/home/someuser/devel/graphite/

[program:carbon]
; this is the only way to get carbon to start
; in a manner that supervisor understands.
; --debug is REQUIRED (apparently)
command=/home/someuser/devel/graphite/bin/carbon-cache.py --debug start
directory=/home/someuser/devel/graphite/
environment=PYTHONPATH="/home/someuser/devel/graphite"
user=cdcd
autostart=true
autorestart=true

Some quick notes.

  1. I tried to start carbon without "--debug," by specifying the virtualenv's python application, and a few other things I have since forgotten. This way is the first one that worked.
  2. Everything is in a virtual environment. I explained the setup here.
Good luck!

Graphite In A virtualenv In A Jail

I am attempting to put Graphite in a virtualenv in a FreeBSD 8.2 jail. It is not that straight-forward. However, I have things working!

Follow for more.

Python Update Breaks virtualenv

Just a quick note that upgrading Python to version 2.7.3 will break current virtualenv's. There is a nice blurb on virtualenv.org.

The solution seems trivial enough: remove bin/python and rerun the virtualenv command. This process will also overwrite bin/activate, so be careful if you have made changes to this file.

$ cd /some/virtualenv/project
$ rm bin/python
$ cd ..
$ virtualenv project