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!

2 comments:

  1. Supervisor expects the command run to stay in the foreground, not fork off a separate process and exit immediately. Twistd, the utility used to daemonize carbon-cache supports a --nodaemon flag that launches the process in the foreground instead of forking it into the background. At the time this article was posted, the only way to get the --nodaemon flag to twistd was by starting carbon-cache with --debug.

    However! The master branch of carbon (on github), as of this comment, now supports forwarding the --nodaemon flag from carbon-cache.py to twistd.

    Instead of

    /home/someuser/devel/graphite/bin/carbon-cache.py --debug start

    you can now:

    /home/someuser/devel/graphite/bin/carbon-cache.py --nodaemon start

    ReplyDelete