mpasternacki/cookbooks — pull request #5 by alexmbird (2014-03-26 15:53:20+00:00)
Title: New supervisord_program settings + fix for xmlrpc socket bug

Hi Maciej,

I have added two things to the code...

1) New supervisord_program settings: redirect_stderr, stopasgroup, killasgroup. These will be valid for the upcoming release of supervisord. Examples, docs and rspec tests are included. See http://supervisord.org/configuration.html for further details.

2) Fix for a bug when restarting supervisord. I've seen this on Ubuntu but it may appear elsewhere too. Service "supervisor" has a reload_command of 'supervisorctl reload' - but when supervisord reinitializes it stops listening on its xmlrpc control socket for a while. This means that if you try to start or restart a supervisord_program immediately afterwards it will fail. Adding a 'sleep 5' after the reload means it has time to reopen the control socket again.

I appreciate that (2) is a little bit hacky as it introduces a 5s delay to supervisord restarts, but you'll never have more than one per Chef run and I can't think of any other way to guarantee it's listening again before we try to call supervisorctl.

Cheers,
Alex.