Ubic services are flexible, they can reuse each other code, use some common base class and change pretty much any part of service behaviour (at least, that's my mission:) )
But there is no way to apply behavoir to all services without changing their code.
So, I'm thinking about adding another kind of ubic objects: plugins.
Plugins will implement one method:
my $modified_service = $plugin->wrap($service);
All plugin objects will be located in /etc/ubic/plugin/, similar to services (but i don't see the point to allow subdirs).
Ubic will then wrap every service with *each* plugin, in alphabetical order or using some kind of priority mechanism, and use modified service instead of original.
Possible applications?
- set ulimit for each service
- centralized logging of all operations
- additional distributed locking - control restart of services on several hosts of cluster, so that they don't restart all at the same time
Plugins will be able to apply some actions only for subset of services, since any service can report its name via ->full_name() method.
So it will be possible, in theory, to have some external ulimit config with services as keys:
# cat >/etc/ubic/plugin/ulimit
use Ubic::Plugin::Ulimit;
Ubic::Plugin::Ulimit->new({
'ubic-ping' => { open_files => 256 },
'fastcgi.*' => { virtual_memory => 256 * 1024 * 1024 },
'fastcgi.my-service' => { core_file_size => 'unlimited' },
});
--
Vyacheslav Matyukhin
http://github.com/berekuk
http://friendfeed.com/mmcleric
http://berekuk.ru