17.09.2012, 20:56, "Иван Бессарабов" <[email protected]>:

>     $ cat /etc/ubic/service/psgi
>     use Ubic::Multiservice::Simple;
>     use Ubic::Service::Plack;
>
>     my $dir = '/home/bessarabov/';
>
>     return Ubic::Multiservice::Simple->new({
>
>         cow => Ubic::Service::Plack->new({
>             server  => "HTTP::Server::PSGI",
>             app     => "$dir/cow.psgi",
>             port    => 5001,
>         }),
>
>         dog => Ubic::Service::Plack->new({
>             server  => "HTTP::Server::PSGI",
>             app     => "$dir/dog.psgi",
>             port    => 5002,
>         }),
>
>     });

Хочу добавить, что если вам не нравится писать конфиги на perl'е, можно 
написать их, например, на json.
Вот этот пример будет эквивалентен предыдущему:
$ cat /etc/ubic/service/psgi/cow.json
{
  "module": "Ubic::Service::Plack",
  "options": {
    "server": "HTTP::Server::PSGI",
    "app": "/home/bessarabov/cow.psgi",
    "port": 5001
  }
}
$ cat /etc/ubic/service/psgi/dog.json
{
  "module": "Ubic::Service::Plack",
  "options": {
    "server": "HTTP::Server::PSGI",
    "app": "/home/bessarabov/dog.psgi",
    "port": 5002
  }
}
Но это менее гибкий вариант, конечно. Вариант на perl можно упаковать до map'а, 
чтобы не копипастить 'server' и имя класса.

Чтобы настроить юзера, достаточно передать опцию 'user'.

Скрипт в /etc/init.d из ubic-сервиса можно сделать в одну строчку, см. 
https://metacpan.org/module/Ubic::Run.
-- 
Moscow.pm mailing list
[email protected] | http://moscow.pm.org

Ответить