Commit | Line | Data |
0ba6e8aa |
1 | package Catalyst::Script::FastCGI; |
2 | |
cc999ce2 |
3 | BEGIN { $ENV{CATALYST_ENGINE} ||= 'FastCGI' } |
cc999ce2 |
4 | use Moose; |
4e45780e |
5 | use MooseX::Types::Moose qw/Str Bool Int/; |
2adf69c3 |
6 | use namespace::autoclean; |
cc999ce2 |
7 | |
d3082fac |
8 | with 'Catalyst::ScriptRole'; |
f4dc8d2f |
9 | |
0e4038c6 |
10 | __PACKAGE__->meta->get_attribute('help')->cmd_aliases('h'); |
b1320d7d |
11 | |
f4dc8d2f |
12 | has listen => ( |
ab7eb5a9 |
13 | traits => [qw(Getopt)], |
f4dc8d2f |
14 | cmd_aliases => 'l', |
53c6ec79 |
15 | isa => Str, |
f4dc8d2f |
16 | is => 'ro', |
d3082fac |
17 | documentation => 'Specify a listening port/socket', |
f4dc8d2f |
18 | ); |
19 | |
20 | has pidfile => ( |
ab7eb5a9 |
21 | traits => [qw(Getopt)], |
f4dc8d2f |
22 | cmd_aliases => 'pid', |
73e4f0f1 |
23 | isa => Str, |
f4dc8d2f |
24 | is => 'ro', |
d3082fac |
25 | documentation => 'Specify a pidfile', |
f4dc8d2f |
26 | ); |
27 | |
ab7eb5a9 |
28 | has daemon => ( |
29 | traits => [qw(Getopt)], |
111d3c9a |
30 | isa => Bool, |
31 | is => 'ro', |
32 | cmd_aliases => 'd', |
53c6ec79 |
33 | documentation => 'Daemonize (go into the background)', |
f4dc8d2f |
34 | ); |
35 | |
ab7eb5a9 |
36 | has manager => ( |
37 | traits => [qw(Getopt)], |
111d3c9a |
38 | isa => Str, |
f4dc8d2f |
39 | is => 'ro', |
53c6ec79 |
40 | cmd_aliases => 'M', |
41 | documentation => 'Use a different FastCGI process manager class', |
f4dc8d2f |
42 | ); |
43 | |
53c6ec79 |
44 | has keeperr => ( |
ab7eb5a9 |
45 | traits => [qw(Getopt)], |
111d3c9a |
46 | cmd_aliases => 'e', |
47 | isa => Bool, |
48 | is => 'ro', |
d3082fac |
49 | documentation => 'Log STDERR', |
f4dc8d2f |
50 | ); |
51 | |
52 | has nproc => ( |
ab7eb5a9 |
53 | traits => [qw(Getopt)], |
111d3c9a |
54 | cmd_aliases => 'n', |
73e4f0f1 |
55 | isa => Int, |
111d3c9a |
56 | is => 'ro', |
53c6ec79 |
57 | documentation => 'Specify a number of child processes', |
f4dc8d2f |
58 | ); |
59 | |
ab7eb5a9 |
60 | has detach => ( |
61 | traits => [qw(Getopt)], |
111d3c9a |
62 | cmd_aliases => 'det', |
63 | isa => Bool, |
64 | is => 'ro', |
d3082fac |
65 | documentation => 'Detach this FastCGI process', |
d9a32f71 |
66 | ); |
cc999ce2 |
67 | |
d3082fac |
68 | sub _application_args { |
69 | my ($self) = shift; |
70 | return ( |
cc999ce2 |
71 | $self->listen, |
57dc50b0 |
72 | { |
cc999ce2 |
73 | nproc => $self->nproc, |
74 | pidfile => $self->pidfile, |
75 | manager => $self->manager, |
76 | detach => $self->detach, |
53c6ec79 |
77 | keep_stderr => $self->keeperr, |
57dc50b0 |
78 | } |
cc999ce2 |
79 | ); |
cc999ce2 |
80 | } |
81 | |
73e4f0f1 |
82 | __PACKAGE__->meta->make_immutable; |
83 | |
d3082fac |
84 | =head1 NAME |
85 | |
86 | Catalyst::Script::FastCGI - The FastCGI Catalyst Script |
87 | |
88 | =head1 SYNOPSIS |
89 | |
53c6ec79 |
90 | myapp_fastcgi.pl [options] |
91 | |
92 | Options: |
93 | -? -help display this help and exits |
94 | -l -listen Socket path to listen on |
95 | (defaults to standard input) |
96 | can be HOST:PORT, :PORT or a |
97 | filesystem path |
98 | -n -nproc specify number of processes to keep |
99 | to serve requests (defaults to 1, |
100 | requires -listen) |
101 | -p -pidfile specify filename for pid file |
102 | (requires -listen) |
103 | -d -daemon daemonize (requires -listen) |
104 | -M -manager specify alternate process manager |
105 | (FCGI::ProcManager sub-class) |
106 | or empty string to disable |
107 | -e -keeperr send error messages to STDOUT, not |
108 | to the webserver |
d3082fac |
109 | |
110 | =head1 DESCRIPTION |
111 | |
53c6ec79 |
112 | Run a Catalyst application as fastcgi. |
d3082fac |
113 | |
114 | =head1 AUTHORS |
115 | |
116 | Catalyst Contributors, see Catalyst.pm |
117 | |
118 | =head1 COPYRIGHT |
119 | |
120 | This library is free software. You can redistribute it and/or modify it under |
121 | the same terms as Perl itself. |
122 | |
123 | =cut |