Ubic::Manual::FAQ - frequently asked questions about Ubic
version 1.60
You have to chown your service files manually. Try this:
find /var/lib/ubic -name '*MY_SERVICE_NAME*' | xargs chown -R MY_NEW_USER
In the future, this one-liner will be reimplemented as "ubic fix-permissions" command. Sorry for the inconvenience.
Yes you can, but you have to be careful.
Perlbrew depends on environment variables, so you have to make sure that they are configured correctly in all cases when you call ubic. This especially includes the crontab entry which ubic installs for you. You'll probably have to edit it manually, like this:
* * * * * . /home/your_login/perl5/perlbrew/etc/bashrc && ubic-watchdog ubic.watchdog >>/dev/null 2>>/dev/null
There are two ways of managing ubic service statuses across reboots.
Trust the ubic to manage service statuses for you. If you start a service and then reboot, ubic.watchdog will bring it back to life automatically.
This is the recommended mode of using ubic. (In other words, this is how author uses it.)
Downside: nobody will do ubic stop on your services before reboot. shutdown(8) will send the SIGTERM, though, usually that's all you need.
ubic stop
shutdown(8)
Turn any ubic service into the init script using Ubic::Run. Register it with rc.d using chkconfig or update-rc.d or however your OS wants you to do it.
chkconfig
update-rc.d
Downsides: 1) more manual work; 2) no persistent statuses: if you stop a service, forget to unregister it from rc.d, and then reboot, it will start again.
Upside: runlevels.
Dot is a reserved symbol, it separates service name parts in service tree (like / separates directories in unix filesystems). So, if you really want the service foo.bar, put its description in /etc/ubic/service/foo/bar.
/
foo.bar
/etc/ubic/service/foo/bar
Dot in config file names is used to distinguish different configuration styles. Extension-less configs are pure-perl, *.ini is ini configs, etc.
Ubic can't distinguish self-daemonizing binary from program which instantly exits, so ubic.watchdog thinks that the service has failed and tries to respawn it every minute.
ubic.watchdog
You can either fix the daemon (hint: many daemons have some kind of --foreground option), or implement your own service class.
--foreground
See Ubic::Service, Ubic::Service::Skeleton, Ubic::Service::Common and "Common service classes" in Ubic::Manual::Overview for more details on writing custom service classes.
Ubic uses cron as the way to bootstrap all its services. This crontab entry will bring the ubic.watchdog up if it ever goes down, and it will then start all other services as necessary.
Even though watchdog itself is very robust, this mechanism is also useful on host reboots.
If you really don't like it, you can pass --no-crontab option to ubic-admin setup command while configuring ubic instance (or just answer no to the appropriate question).
--no-crontab
ubic-admin setup
no
This process guards any daemon started with Ubic::Daemon module.
Ubic::Daemon
Optionally, ubic-guardian can write some information to its log, for example, the exit code or signal in case of service failure. Despite its name, ubic-guardian *does not* restart the service on failures. It's the job for the completely different program, ubic-watchdog.
It also holds the lock on the pidfile for a whole lifetime, which theoretically makes daemons more secure, but it's more of a historical nuance than the necessity.
It's probable that ubic-guardian will become optional in the future (i.e. it will only be created if service asks for ubic_log). Anyway, don't worry about it, it's completely harmless.
ubic.update service (and ubic-update script) updates portmap - local { port => service-name } mapping. It makes possible to check a service status via ubic.ping using service port instead of its name:
ubic.update
{ port => service-name }
ubic.ping
$ wget -q -O - 'http://localhost:12345/status/port/12345' ok
Resolving of service by port can't be done on-the-fly by ubic.ping, because all service definitions are cached internally by Ubic.pm (Ubic::Multiservice, actually, but you don't have to know the difference), since constant reloading of service definition can cause memory leaks. So ubic.ping just loads portmap generated by ubic.update instead, resolves service name by port, and loads cached service status from another local file.
In other words, if you don't use ubic.ping, you can stop both ubic.update and ubic.ping services.
It's called after "Ubik" - science fiction novel by Philip K. Dick. I spelled it incorrectly in early releases, because "c" and "k" are indistinguishable in Russian language, and now it's too late to fix this.
Why is it called after "Ubik"? Well, these two quotes can hint to some suggestions:
"This substance, whose name is derived from the word "ubiquity", has the property of preserving people who are in half-life." "Ubik is a metaphor for God. Ubik is all-powerful and all-knowing, and Ubik is everywhere."
Alternatively, one possible backronym is "Ubic Because I Can" :) (Thanks to Christopher Paulicka for suggesting it!)
Vyacheslav Matyukhin <mmcleric@yandex-team.ru>
This software is copyright (c) 2016 by Yandex LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Ubic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ubic
CPAN shell
perl -MCPAN -e shell install Ubic
For more information on module installation, please visit the detailed CPAN module installation guide.