line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Clustericious::Command::nginx; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
592
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
6
|
use Clustericious::App; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
17
|
use Clustericious::Config; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
7
|
1
|
|
|
1
|
|
5
|
use File::Path qw( mkpath ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
8
|
1
|
|
|
1
|
|
5
|
use base 'Clustericious::Command'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
9
|
1
|
|
|
1
|
|
6
|
use Clustericious::Log; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
612
|
use File::Which qw( which ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
240
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Clustericious command to stat nginx |
13
|
|
|
|
|
|
|
our $VERSION = '1.27'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
__PACKAGE__->attr(description => <<EOT); |
17
|
|
|
|
|
|
|
Start an nginx web server. |
18
|
|
|
|
|
|
|
EOT |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__PACKAGE__->attr(usage => <<EOT); |
21
|
|
|
|
|
|
|
Usage $0: nginx -p <prefix> [...other nginx options] |
22
|
|
|
|
|
|
|
Starts an nginx webserver. |
23
|
|
|
|
|
|
|
Options are passed verbatim to the nginx executable. |
24
|
|
|
|
|
|
|
EOT |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub run { |
27
|
0
|
|
|
0
|
1
|
|
my($self, @args) = @_; |
28
|
0
|
|
|
|
|
|
my $app_name = $ENV{MOJO_APP}; |
29
|
0
|
|
|
|
|
|
my %args = @args; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
$self->app->init_logging; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
my $prefix = $args{-p} or INFO "no prefix for nginx"; |
34
|
0
|
|
|
|
|
|
mkpath "$prefix/logs"; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
my $nginx = which('nginx') or LOGDIE "could not find nginx in $ENV{PATH}"; |
37
|
0
|
|
|
|
|
|
DEBUG "starting $nginx @args"; |
38
|
0
|
|
|
|
|
|
system$nginx, @args; |
39
|
0
|
0
|
|
|
|
|
die "'$nginx @args' Failed to execute: $!" if $? == -1; |
40
|
0
|
0
|
|
|
|
|
die "'$nginx @args' Killed with signal: ", $? & 127 if $? & 127; |
41
|
0
|
0
|
|
|
|
|
die "'$nginx @args' Exited with ", $? >> 8 if $? >> 8; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding UTF-8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Clustericious::Command::nginx - Clustericious command to stat nginx |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
version 1.27 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Start an nginx web server. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Clustericious::Command::nginx - Clustericious command to stat nginx |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 EXAMPLES |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 nginx proxy |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
--- |
73
|
|
|
|
|
|
|
% my $root = dir "@{[ home ]}/var/run"; |
74
|
|
|
|
|
|
|
% $root->mkpath(0,0700); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
url: http://<%= $host %>:<%= $port %> |
77
|
|
|
|
|
|
|
start_mode: |
78
|
|
|
|
|
|
|
- hypnotoad |
79
|
|
|
|
|
|
|
- nginx |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
nginx: |
82
|
|
|
|
|
|
|
args: -p <%= $root %>/nginx.<%= $port %>/ |
83
|
|
|
|
|
|
|
autogen: |
84
|
|
|
|
|
|
|
filename: <%= $root %>/nginx.<%= $port %>/conf/nginx.conf |
85
|
|
|
|
|
|
|
content: | |
86
|
|
|
|
|
|
|
worker_processes auto; |
87
|
|
|
|
|
|
|
events { |
88
|
|
|
|
|
|
|
use epoll; |
89
|
|
|
|
|
|
|
worker_connections 4096; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
http { |
92
|
|
|
|
|
|
|
server { |
93
|
|
|
|
|
|
|
listen <%= $host %>:<%= $port %>; |
94
|
|
|
|
|
|
|
location / { |
95
|
|
|
|
|
|
|
proxy_pass http://127.0.0.1:<%= $port %>; |
96
|
|
|
|
|
|
|
proxy_http_version 1.1; |
97
|
|
|
|
|
|
|
proxy_read_timeout 300; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
hypnotoad: |
103
|
|
|
|
|
|
|
listen: |
104
|
|
|
|
|
|
|
- http://127.0.0.1:<%= $port %> |
105
|
|
|
|
|
|
|
pid_file: <%= $root %>/hypnotoad.<%= $port %>.pid |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SEE ALSO |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L<Clustericious> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Original author: Brian Duggan |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Current maintainer: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Contributors: |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Curt Tilmes |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Yanick Champoux |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This software is copyright (c) 2013 by NASA GSFC. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
128
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |