NAME
Ubic::Service::Plack - Helper for running psgi applications with ubic and plackup
VERSION
version 1.14
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.14
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 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. - app
-
Path to .psgi 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 under which plackup will be started.
- group (optional)
-
Group under which plackup will be started. Default is all user groups.
- cwd (optional)
-
Change working directory before starting a daemon.
- env (optional)
-
Modify environment before starting a daemon. Must be a plain hashref if specified.
- pidfile (optional)
-
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
Yury Zavarin <yury.zavarin@gmail.com>
Vyacheslav Matjukhin <mmcleric@yandex-team.ru>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 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.