Yury Zavarin > Ubic-Service-Plack-1.16 > Ubic::Service::Plack

Download:
Ubic-Service-Plack-1.16.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  1
View/Report Bugs
Module Version: 1.16   Source  

NAME ^

Ubic::Service::Plack - Helper for running psgi applications with ubic and plackup

VERSION ^

version 1.16

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",
        status   => sub { ... },
        port     => 4444,
        ubic_log => '/var/log/app/ubic.log',
        stdout   => '/var/log/app/stdout.log',
        stderr   => '/var/log/app/stderr.log',
        user     => "www-data",
    });

DESCRIPTION ^

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

NAME ^

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

VERSION ^

version 1.16

METHODS ^

new($params)

Parameters (optional if not specified otherwise):

app (mandatory)

Path to .psgi app.

server (mandatory)

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

Hashref with options that will be 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.

status

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

port

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

ubic_log

Path to ubic log.

stdout

Path to stdout log of plackup.

stderr

Path to stderr log of plackup.

user

User under which plackup will be started.

group

Group under which plackup will be started. Default is all user groups.

cwd

Change working directory before starting a daemon.

env

Modify environment before starting a daemon. Must be a plain hashref if specified.

pidfile

Pidfile for Ubic::Daemon module.

If not specified, it will be derived from service's name or from app_name, if provided.

Pidfile is:

  • pidfile option value, if provided;
  • /tmp/APP_NAME.pid, where APP_NAME is app_name option value, if it's provided;
  • /tmp/SERVICE_NAME.pid, where SERVICE_NAME is service's full name.
app_name

Name of your application. DEPRECATED.

It was used in older releases for constructing the path for storing pid-file of your app.

pidfile()

Get pidfile name.

bin()

Get command-line with all arguments in the arrayref form.

FUTURE DIRECTIONS ^

Some kind of basic HTTP/socket (depending on server type) ping in status phase would be handy.

AUTHORS ^

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 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.

syntax highlighting: