Skip to content

Commit

Permalink
Plack::Handler::FCGI - Support Server::Starter
Browse files Browse the repository at this point in the history
Support Server::Starter to allow hot-deploying in a defacto-standard manner.
It doesn't require Server::Starter module until SERVER_STARTER_PORT env is set.
  • Loading branch information
Haruka Iwao committed Oct 28, 2013
1 parent f168ddc commit 4bb93b8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Plack/Handler/FCGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ sub run {
if (-S STDIN) {
# running from web server. Do nothing
# Note it should come before listen check because of plackup's default
} elsif ($ENV{SERVER_STARTER_PORT}) {
# Runing under Server::Starter
require Server::Starter;
my %socks = %{Server::Starter::server_ports()};
if (scalar(keys(%socks)) > 1) {
die "More than one socket are specified by Server::Starter";
}
$sock = (values %socks)[0];
} elsif ($self->{listen}) {
my $old_umask = umask;
unless ($self->{leave_umask}) {
Expand Down Expand Up @@ -409,6 +417,14 @@ mod_fcgid:
FcgiPassHeader Authorization
=head2 Server::Starter
This plack handler supports L<Server::Starter> as a superdaemon.
Simply launch plackup from start_server with a path option.
The listen option is ignored when launched from Server::Starter.
start_server --path=/tmp/socket -- plackup -s FCGI app.psgi
=head1 SEE ALSO
L<Plack>
Expand Down

0 comments on commit 4bb93b8

Please sign in to comment.