NAME

Ubic::Service::Plack - ubic service base class for psgi applications

VERSION

version 1.11

SYNOPSIS

use Ubic::Service::Plack;
return Ubic::Service::Plack->new({
    server => "FCGI",
    server_args => { listen => "/tmp/app.sock",
                     nproc  => 5 },
    app      => "/var/www/app.psgi",
    app_name => 'app',
    status   => sub { ... },
    port     => 4444,
    ubic_log => '/var/log/app/ubic.log',
    stdout   => '/var/log/app/stdout.log',
    stderr   => '/var/log/app/stderr.log',
    user     => "ppb",
});

DESCRIPTION

This service is a common ubic wrap for psgi applications. It uses plackup for running these applications.

METHODS

new($params)

Parameters (mandatory if not specified otherwise):

server

Server name from Plack::Server::* or Plack::Handler::* namespace. You can pass this param in both variants, for example 'Plack::Handler::FCGI' or just 'FCGI'.

server_args (optional)

Hashref with options that will passed to concrete Plack server specified by server param. See concrete server docimentation for possible options. You can also pass here such options as 'env' to override defaults. In this case you must use long option names ('env' insted of 'E').

app

Path to .psgi app.

app_name

Name of your application (uses for constructing path for storing pid-file of your app).

status (optional)

Coderef to special function, that will check status of your application.

port (optional)

Port on which your application works. Ubic-ping will use this info for HTTP status checking of your application.

ubic_log (optional)

Path to ubic log.

stdout (optional)

Path to stdout log of plackup.

stderr (optional)

Path to stderr log of plackup.

user (optional)

User name. If specified, real and effective user identifiers will be changed before execing any psgi applications.

pidfile (optional)

Pidfile for Ubic::Daemon module.

If not specified, it will be derived from app_name.

AUTHORS

Yury Zavarin <yury.zavarin@gmail.com> Vyacheslav Matjukhin <mmcleric@yandex-team.ru>