Guys, Attached is a service provider that works with runit (http://smarden.sunsite.dk/runit/) and probably also daemontools (not tested). It''s not the prettiest code in the world, but this is my first stab at anything ruby (apart from a few really simple facts for facter) so I''m aware of the following: a) We should be looping through an array when checking for service directories b) I should check for more locations for the "sv" program, as it could easily be placed elsewhere. But apart from that, any comments? I am fundamentally on the right track here? Furthermore, I have a truckload of glue code in a separate runit module to ensure proper directories are in place for the various services, logging is set up properly and so on - I can post it here if somebody wants to give it a try. My main problem is that I have to check in my baseclass if we''re using runit on a given machine and then set a global variable (and override my default Provider) that subsequent classes then use to know how to deal with this. It''s messy, but it works. On an entirely separate note, I can only recommend runit (and similar schemes) - it''s pretty damn cool being sure the various daemons run as you want them to. -- /peter _______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
Adam Jacob
2008-Feb-13 18:10 UTC
Re: [Puppet-dev] [Puppet-users] Comments regd new service provider
On 2/13/08, Peter Hoeg <peter@hoeg.com> wrote:> Guys, > > Attached is a service provider that works with runit > (http://smarden.sunsite.dk/runit/) and probably also daemontools (not > tested).Neat!> It''s not the prettiest code in the world, but this is my first stab at > anything ruby (apart from a few really simple facts for facter) so I''m > aware of the following: > > a) We should be looping through an array when checking for service directoriesOr you can have this work on a per-platform basis. Ubuntu/Debian uses /var/service, for example.> b) I should check for more locations for the "sv" program, as it could > easily be placed elsewhere.Yep. This may show up in /usr/bin, /usr/sbin, /usr/local/bin, etc.> But apart from that, any comments? I am fundamentally on the right track here?Yeah. We use runit all the time, and we just use Puppet''s native Service type along with a symlink to sv in /etc/init.d. Clearly, we''re not using runit as a replacement for init -- just as job control.> Furthermore, I have a truckload of glue code in a separate runit > module to ensure proper directories are in place for the various > services, logging is set up properly and so on - I can post it here if > somebody wants to give it a try.Go for it. We''ve got a runit module that does the install and defines a runit_service type that takes a path to a template directory that contains a run.erb and log-run.erb file. For example: runit_service { "iclassify-solr": templatedir => "iclassify/solr", require => [ Rails_app["iclassify"], Class["java"] ] } Would set up /etc/sv/iclassify-solr, populate the run and log/run scripts, link it to /var/service, and set up a symlink to sv called iclassify-solr in /etc/init.d. We also can do: runit_service { "moonin-poller": templatedir => "munin/moonin-poller", downif => "/usr/bin/test ! -f /srv/moonin", } Which will automatically do an sv down on the service if the condition isn''t met. This is handy for services that get deployed to the box by some mechanism other than puppet. Capistrano, for example.> My main problem is that I have to check in my baseclass if we''re using > runit on a given machine and then set a global variable (and override > my default Provider) that subsequent classes then use to know how to > deal with this. It''s messy, but it works.Are you using runit everywhere?> On an entirely separate note, I can only recommend runit (and similar > schemes) - it''s pretty damn cool being sure the various daemons run as > you want them to.Yeah, runit is great. One thing you might want to consider is adding in all the great extra functionality you get from using something like Runit. I''m thinking specifically of the ease with which you can send signals, which would be a great thing to have in puppet. Adam -- HJK Solutions - We Launch Startups - http://www.hjksolutions.com Adam Jacob, Senior Partner T: (206) 508-4759 E: adam@hjksolutions.com