Skip to content

Commit 6af04cc

Browse files
committedJan 2, 2012
Merge branch 'master' of github.com:plainblack/wrebuild
2 parents 2cb058c + 64d2f53 commit 6af04cc

23 files changed

+412
-2460
lines changed
 

‎Task-WebGUI/dist.ini

+122-188
Original file line numberDiff line numberDiff line change
@@ -13,205 +13,139 @@ repository.web = http://github.com/plainblack/wrebuild
1313
repository.type = git
1414

1515
[Prereqs]
16+
17+
App::Cmd = 0.311
1618
App::cpanminus = 1.5006
17-
Test::Tester = 0.107
18-
Test::NoWarnings = 1.02
19-
common::sense = 3.4
20-
Test::Harness = 3.17
21-
Locales = 0.19
22-
Text::Diff::HTML = 0.06
23-
CAM::PDF = 1.52
24-
Text::PDF = 0.29
25-
Crypt::RC4 = 2.02
26-
LWPx::ParanoidAgent = 1.04
27-
Crypt::DH = 0.06
28-
Math::BigInt::FastCalc = 0.19
29-
YAML = 0.68
30-
Class::Member = 1.6
31-
GraphViz = 2.04
32-
IPC::Run = 0.82
33-
Readonly = 1.03
34-
Algorithm::C3 = 0.07
35-
Class::C3::XS = 0.11
19+
App::Nopaste = 0.17
20+
Archive::Any = 0.0932
21+
Archive::Tar = 1.44
22+
Archive::Zip = 1.26
23+
Business::OnlinePayment = 3.01
24+
Business::OnlinePayment::AuthorizeNet = 3.21
25+
Business::PayPal::API = 0.62
26+
Business::Tax::VAT::Validation = 0.20
27+
Cache::FastMmap = 1.35
28+
Capture::Tiny = 0.08
29+
CHI
3630
Class::C3 = 0.21
37-
XML::TreePP = 0.38
38-
XML::FeedPP = 0.40
39-
Net::SSLeay = 1.36
40-
Compress::Raw::Zlib = 2.015
31+
Clipboard = 0.09
32+
Clone = 0.31
33+
Color::Calc = 1.05
34+
common::sense = 3.4
4135
Compress::Zlib = 2.015
42-
BSD::Resource = 1.2902
43-
URI = 1.51
44-
IO::Zlib = 1.09
45-
HTML::Tagset = 3.20
46-
HTML::Tree = 3.23
47-
HTML::Parser = 3.64
48-
LWP = 5.834
49-
CGI = 3.42
50-
Digest::HMAC = 1.01
51-
Digest::MD5 = 2.39
52-
Digest::SHA1 = 2.12
53-
Module::Build = 0.31012
54-
Params::Validate = 0.91
55-
DateTime::Locale = 0.42
56-
Class::Singleton = 1.4
57-
DateTime::TimeZone = 0.84
58-
Time::Local = 1.1901
59-
Test::Simple = 0.94
60-
Devel::Symdump = 2.08
61-
Pod::Escapes = 1.04
62-
ExtUtils::CBuilder = 0.24
63-
Pod::Coverage = 0.19
64-
Pod::Simple = 3.10
65-
Pod::Text = 2.2.2
36+
Config::JSON = 1.51.1
37+
Crypt::SSLeay = 0.57
38+
CSS::Minifier::XS = 0.03
39+
CSS::Packer = 1.002
40+
Data::ICal = 0.16
6641
DateTime = 0.4501
42+
DateTime::Event::ICal = 0.10
43+
DateTime::Format::HTTP = 0.38
44+
DateTime::Format::Mail = 0.3001
6745
DateTime::Format::Strptime = 1.0800
68-
HTML::Template = 2.9
69-
Crypt::SSLeay = 0.57
70-
String::Random = 0.22
71-
Time::HiRes = 1.9719
72-
Text::Balanced = 2.02
73-
Tie::IxHash = 1.21
74-
Tie::CPHash = 1.04
75-
Error = 0.17016
46+
DBD::mysql = 4.010
47+
DBI = 1.615
48+
Devel::StackTrace = 1.27
49+
Devel::StackTrace::WithLexicals = 0.03
50+
Digest::MD5 = 2.38
51+
Digest::SHA = 5.47
52+
Email::Valid
53+
Exception::Class = 1.26
54+
Facebook::Graph = 0.0505
55+
File::Path = 2.07
56+
File::Slurp = 9999.13
57+
Finance::Quote = 1.15
58+
Geo::Coder::Googlev3 = 0.07
59+
HTML::Form = 5.800
7660
HTML::Highlight = 0.20
61+
HTML::Packer = 1.000
62+
HTML::Parser = 3.60
63+
HTML::TagCloud = 0.34
7764
HTML::TagFilter = 1.03
78-
IO::String = 1.08
79-
Archive::Tar = 1.44
80-
Archive::Zip = 1.26
81-
XML::NamespaceSupport = 1.09
82-
XML::SAX::Base = 1.02
83-
XML::Parser = 2.36
84-
XML::SAX = 0.96
85-
XML::SAX::Expat = 0.40
86-
XML::Simple = 2.18
87-
XML::RSSLite = 0.11
88-
SOAP::Lite = 0.710.08
89-
DBI = 1.615
90-
DBD::mysql = 4.018
91-
Convert::ASN1 = 0.22
92-
HTML::TableExtract = 2.10
93-
Finance::Quote = 1.17
94-
JSON::XS = 2.26
65+
HTML::Template = 2.9
66+
HTML::Template::Expr = 0.07
67+
HTTP::BrowserDetect = 1.19
68+
HTTP::Exception
69+
HTTP::Headers = 1.61
70+
HTTP::Request = 1.40
71+
Image::ExifTool = 8.00
72+
Image::Magick = 6.0
73+
IO::File::WithPath
74+
IO::Socket::SSL
75+
IO::Zlib = 1.09
76+
JavaScript::Minifier::XS = 0.05
77+
JavaScript::Packer = 1.004
9578
JSON = 2.17
96-
version = 0.76
97-
Path::Class = 0.16
98-
Mouse = 0.93
99-
Any::Moose = 0.15
100-
Config::JSON = 1.5100
101-
IO::Socket::SSL = 1.22
102-
Authen::SASL = 2.12
103-
Net::LDAP = 0.39
79+
JSON::Any = 1.22
80+
JSON::PP = 0.00
81+
JSON::XS = 2.26
82+
Kwargs
83+
List::MoreUtils = 0.22
84+
List::Util = 1.19
85+
Locales = 0.19
10486
Log::Log4perl = 1.20
105-
POE = 1.283
106-
POE::Component::IKC = 0.2002
107-
String::CRC32 = 1.4
108-
ExtUtils::XSBuilder = 0.28
109-
ExtUtils::MakeMaker = 6.48
110-
Devel::XRay = 0.95
111-
Clone = 0.31
112-
Test::Pod = 1.26
113-
Data::Structure::Util = 0.15
114-
Parse::RecDescent = 1.96.0
115-
Mail::Mailer = 2.04
116-
IO::Stringy = 2.110
87+
LWP = 5.834
11788
MIME::Tools = 5.427
118-
HTML::Template::Expr = 0.07
119-
Template = 2.22
120-
List::Util = 1.19
121-
Graphics::ColorNames = 2.11
122-
Module::Load = 0.16
123-
Color::Calc = 1.05
124-
DateTime::Format::Mail = 0.3001
125-
Digest::BubbleBabble = 0.01
126-
Net::IP = 1.25
127-
Net::DNS = 0.65
128-
POE::Component::Client::DNS = 1.051
129-
POE::Component::Client::Keepalive = 0.262
130-
POE::Component::Client::HTTP = 0.893
131-
Test::Deep = 0.103
132-
Test::MockObject = 1.20110612
133-
UNIVERSAL::isa = 1.03
134-
UNIVERSAL::can = 1.15
135-
Class::MakeMethods = 1.01
136-
Locale::US = 1.2
137-
Time::Format = 1.09
138-
Weather::Com = 0.5.3
139-
File::Slurp = 9999.13
140-
Text::CSV_XS = 0.69
141-
File::Temp = 0.21
142-
File::Path = 2.07
143-
File::Which = 0.05
144-
Class::InsideOut = 1.09
145-
HTML::TagCloud = 0.34
146-
Set::Infinite = 0.63
147-
DateTime::Set = 0.26
148-
DateTime::Event::Recurrence = 0.16
149-
DateTime::Event::ICal = 0.09
150-
MIME::Types = 1.27
151-
File::MMagic = 1.27
152-
File::Spec = 3.29
89+
Module::Build = 0.31012
15390
Module::Find = 0.06
154-
Archive::Any = 0.0932
155-
Image::ExifTool = 8.00
156-
MySQL::Diff = 0.33
157-
List::MoreUtils = 0.22
158-
Devel::StackTrace = 1.20
159-
Class::Data::Inheritable = 0.08
160-
Exception::Class = 1.26
161-
Sub::Uplevel = 0.2002
162-
Carp::Assert = 0.20
163-
Test::Exception = 0.27
164-
Carp::Assert::More = 1.12
165-
HTTP::Server::Simple = 0.44
166-
Test::LongString = 0.15
167-
HTTP::Response::Encoding = 0.05
168-
Array::Compare = 2.01
169-
Tree::DAG_Node = 1.06
170-
Test::Warn = 0.11
171-
Devel::Cycle = 1.10
172-
PadWalker = 1.7
173-
Test::Memory::Cycle = 1.04
174-
Test::Taint = 1.04
175-
WWW::Mechanize = 1.54
176-
Test::WWW::Mechanize = 1.24
177-
Test::JSON = 0.06
178-
Regexp::RegGrp = 1.002
179-
HTML::Packer = 1.002001
180-
JavaScript::Packer = 1.004
181-
CSS::Packer = 1.002
182-
Business::Tax::VAT::Validation = 0.20
183-
Scope::Guard = 0.03
184-
Digest::SHA = 5.47
185-
JavaScript::Minifier::XS = 0.05
186-
CSS::Minifier::XS = 0.03
187-
Crypt::OpenSSL::Random = 0.04
188-
Crypt::OpenSSL::RSA = 0.26
189-
Crypt::CBC = 2.30
190-
Test::Class = 0.31
191-
XML::SAX::Writer = 0.53
192-
XML::Filter::BufferText = 1.01
193-
Net::CIDR::Lite = 0.20
194-
Params::Util = 1.00
195-
Sub::Install = 0.925
196-
Data::OptList = 0.104
197-
Sub::Exporter = 0.982
198-
Devel::GlobalDestruction = 0.02
199-
MRO::Compat = 0.11
200-
Sub::Name = 0.04
201-
Task::Weaken = 1.03
202-
Try::Tiny = 0.02
203-
Class::MOP = 0.97
91+
Module::Load = 0.16
92+
Monkey::Patch = 0.03
20493
Moose = 0.93
205-
Getopt::Long::Descriptive = 0.081
20694
MooseX::Getopt = 0.25
207-
WWW::Pastebin::PastebinCom::Create = 0.003
208-
Class::Data::Accessor = 0.04004
209-
WWW::Pastebin::RafbNet::Create = 0.001
210-
Spiffy = 0.30
211-
Clipboard = 0.09
212-
Mixin::Linewise = 0.002
213-
Config::INI = 0.014
214-
App::Nopaste = 0.17
215-
Business::PayPal::API = 0.69
95+
MooseX::NonMoose = 0.07
96+
MooseX::Storage = 0.23
97+
MooseX::Storage::Format::JSON = 0.27
98+
namespace::autoclean = 0.09
99+
Net::CIDR::Lite = 0.20
100+
Net::DNS = 0.66
101+
Net::LDAP = 0.39
102+
Net::POP3 = 2.29
103+
Net::SMTP = 2.31
104+
Net::Twitter = 3.13006
105+
Number::Format
106+
Package::Stash
107+
Params::Validate = 0.91
108+
Path::Class = 0.16
109+
PerlIO::eol = 0.14
216110
Plack = 0.9985
217-
111+
Plack::Middleware::Debug = 0.14
112+
Plack::Middleware::SizeLimit
113+
Plack::Middleware::Status = 1.101150
114+
Pod::Coverage = 0.19
115+
POE = 1.283
116+
POE::Component::Client::DNS = 1.051
117+
POE::Component::Client::HTTP = 0.88
118+
POE::Component::Client::Keepalive = 0.262
119+
POE::Component::IKC = 0.2002
120+
POE::Component::IKC::Server = 0.2001
121+
POSIX
122+
Readonly = 1.03
123+
Scope::Guard = 0.20
124+
Search::QueryParser
125+
Template = 2.20
126+
Test::Class = 0.31
127+
Test::Deep = 0.095
128+
Test::Differences = 0.5
129+
Test::Exception = 0.27
130+
Test::Harness = 3.17
131+
Test::Log::Dispatch = 0
132+
Test::LongString = 0.13
133+
Test::MockObject = 1.02
134+
Test::MockTime = 0.09
135+
Test::More = 0.96
136+
Test::Tester = 0
137+
Text::Aspell = 0.012
138+
Text::Balanced = 2.00
139+
Text::CSV_XS = 0.64
140+
Tie::IxHash = 1.21
141+
Time::HiRes = 1.9719
142+
Try::Tiny = 0.07
143+
UNIVERSAL::can = 1.15
144+
UNIVERSAL::isa = 1.03
145+
URI::Escape = 3.29
146+
UUID::Tiny = 1.03
147+
Weather::Com::Finder = 0.5.3
148+
XML::FeedPP = 0.40
149+
XML::FeedPP::MediaRSS = 0.02
150+
XML::Simple = 2.18
151+
YAML = 0.68

‎build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ buildPerl(){
310310
buildNginx(){
311311
printHeader "nginx"
312312
cd source
313-
cd nginx-0.7.67
313+
cd nginx-1.0.11
314314
#./configure --prefix=$PREFIX --with-pcre=../pcre-8.20 --with-http_ssl_module --with-openssl=../openssl-1.0.0e; checkError $? "nginx Configure"
315315
./configure --prefix=$PREFIX --with-pcre=../pcre-8.20 --with-http_ssl_module; checkError $? "nginx Configure"
316316
$WRE_MAKE; checkError $? "nginx make"
@@ -347,7 +347,7 @@ buildImageMagick(){
347347
buildProgram "giflib-4.1.6" "--enable-shared $CFG_CACHE"
348348

349349
# lib png
350-
buildProgram "libpng-1.5.6" "--enable-shared $CFG_CACHE"
350+
buildProgram "libpng-1.5.7" "--enable-shared $CFG_CACHE"
351351

352352
# graphviz
353353
buildProgram "graphviz-2.24.0" "$CFG_CACHE --enable-static --with-libgd=no --with-mylibgd=no --disable-java --disable-swig --disable-perl --disable-python --disable-php --disable-ruby --disable-sharp --disable-python23 --disable-python24 --disable-python25 --disable-r --disable-tcl --disable-guile --disable-io --disable-lua --disable-ocaml"

‎getsource.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ tar xfz pcre-8.20.tar.gz
1313
#wget http://openssl.org/source/openssl-1.0.0e.tar.gz
1414
#tar xfz openssl-1.0.0e.tar.gz
1515

16-
wget http://nginx.org/download/nginx-0.7.67.tar.gz
17-
tar xfz nginx-0.7.67.tar.gz
16+
wget http://nginx.org/download/nginx-1.0.11.tar.gz
17+
tar xfz nginx-1.0.11.tar.gz
1818

1919
#wget http://www.monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
2020
#tar xfz libevent-1.4.14b-stable.tar.gz
@@ -99,8 +99,8 @@ wget -t 4 -nv http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.24.
9999
tar xfz graphviz-2.24.0.tar.gz
100100

101101
# libpng image manipulation http://www.libpng.org/pub/png/libpng.html
102-
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.6.tar.gz
103-
tar xfz libpng-1.5.6.tar.gz
102+
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.7.tar.gz
103+
tar xfz libpng-1.5.7.tar.gz
104104

105105
# gnu libtool http://www.gnu.org/software/libtool/
106106
#wget -t 4 -nv http://ftp.gnu.org/gnu/libtool/libtool-2.2.6a.tar.gz

‎wre/lib/WRE/File.pm

+4-3
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ Either a path to a template file as a scalar or a scalar reference to a template
315315
=head3 vars
316316
317317
A hash reference containing the template variables to process on the template. The following template variables
318-
are automatically generated and added to the list: databaseHost, databasePort, modproxyPort, modperlPort,
318+
are automatically generated and added to the list: databaseHost, databasePort, nginxPort, starmanPort,
319319
domainRoot, wreRoot, webguiRoot
320320
321321
=cut
@@ -332,10 +332,11 @@ sub processTemplate {
332332
}
333333

334334
# add in some template template variables
335+
$var->{config} = $config;
335336
$var->{databaseHost} = $config->get("mysql/hostname");
336337
$var->{databasePort} = $config->get("mysql/port");
337-
$var->{modproxyPort} = $config->get("apache/modproxyPort");
338-
$var->{modperlPort} = $config->get("apache/modperlPort");
338+
$var->{nginxPort} = $config->get("nginx/port");
339+
$var->{starmanPort} = $config->get("starman/port");
339340
$var->{domainRoot} = $config->getDomainRoot;
340341
$var->{wreRoot} = $config->getRoot;
341342
$var->{wreUser} = $config->get("user");

‎wre/lib/WRE/Modproxy.pm

-144
This file was deleted.

‎wre/lib/WRE/Modperl.pm renamed to ‎wre/lib/WRE/Starman.pm

+28-39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package WRE::Modperl;
1+
package WRE::Starman;
22

33
#-------------------------------------------------------------------
44
# WRE is Copyright 2005-2011 Plain Black Corporation.
@@ -18,6 +18,7 @@ use HTTP::Request;
1818
use HTTP::Headers;
1919
use LWP::UserAgent;
2020
use WRE::Host;
21+
use Proc::ProcessTable;
2122

2223
=head1 ISA
2324
@@ -38,7 +39,7 @@ Returns human readable name.
3839
=cut
3940

4041
sub getName {
41-
return "Apache/mod_perl";
42+
return "Starman";
4243
}
4344

4445
#-------------------------------------------------------------------
@@ -52,15 +53,11 @@ killed.
5253

5354
sub killRunaways {
5455
my $self = shift;
55-
eval { require Proc::ProcessTable; };
56-
if ($@) { # can't check if this module doesn't exist (eg: windows)
57-
return 0;
58-
}
5956
my $killed = 0;
6057
my $processTable = Proc::ProcessTable->new;
61-
my $maxMemory = $self->wreConfig->get("apache/maxMemory");
58+
my $maxMemory = $self->wreConfig->get("starman/maxMemory");
6259
foreach my $process (@{$processTable->table}) {
63-
next unless ($process->cmndline =~ /httpd.* -D WRE-modperl /);
60+
next unless ($process->cmndline =~ /starman/);
6461
if ($process->size >= $maxMemory) {
6562
$killed += $process->kill(9);
6663
}
@@ -79,18 +76,18 @@ Returns a 1 if Modperl is running, or a 0 if it is not.
7976

8077
sub ping {
8178
my $self = shift;
82-
my $apache = $self->wreConfig->get("apache");
79+
my $starman = $self->wreConfig->get("starman");
8380
my $userAgent = LWP::UserAgent->new;
8481
$userAgent->agent("wre/1.0");
85-
$userAgent->timeout($apache->{connectionTimeout});
82+
$userAgent->timeout($starman->{connectionTimeout});
8683
my $header = HTTP::Headers->new;
87-
my $url = "http://".$apache->{defaultHostname}.":".$apache->{modperlPort}."/";
84+
my $url = "http://".$starman->{defaultHostname}.":".$starman->{port}."/";
8885
my $request = HTTP::Request->new( GET => $url, $header);
8986
my $response = $userAgent->request($request);
9087
if ($response->is_success || $response->code eq "401") {
9188
return 1;
9289
}
93-
croak "Modperl received error code ".$response->code." with message ".$response->error_as_HTML;
90+
croak "starman received error code ".$response->code." with message ".$response->error_as_HTML;
9491
return 0;
9592
}
9693

@@ -109,24 +106,27 @@ sub start {
109106
my $count = 0;
110107
my $success = 0;
111108
my $config = $self->wreConfig;
112-
$config->set("wreMonitor/modperlAdministrativelyDown", 0);
109+
$config->set("wreMonitor/starmanAdministrativelyDown", 0);
113110
my $host = WRE::Host->new(wreConfig=>$config);
114-
unless ($config->get("apache/modperlPort") > 1024 || $host->isPrivilegedUser) {
111+
unless ($config->get("starman/port") > 1024 || $host->isPrivilegedUser) {
115112
croak "You are not an administrator on this machine so you cannot start services with ports 1-1024.";
116113
}
117114
my $cmd = "";
118-
if ($host->getOsName eq "windows") {
119-
$cmd = "net start WREmodperl";
120-
}
121-
else {
122-
$cmd = $config->getRoot("/prereqs/bin/apachectl")." -f ".$config->getRoot("/etc/modperl.conf")
123-
." -D WRE-modperl -E ".$config->getRoot("/var/logs/modperl.error.log")." -k start";
124-
}
115+
#start_server --pid-file=/data/wre/var/run/starman.pid --port=8081 --status=/data/wre/var/run/starman.status starman --preload=/data/WebGUI/app.psgi
116+
$cmd = $config->getRoot("/prereqs/bin/start_server")
117+
. " --pid=" . $config->getRoot("var/run/starman.pid")
118+
. " --status=" . $config->getRoot("var/run/starman.status")
119+
. " --port=" . $config->get("starman/port")
120+
. " starman" #Beginning of the starman specific configurations
121+
. " --preload=" . $config->get("webgui/root") . "/app.psgi"
122+
. " --access-log=" . $config->getRoot("var/logs/starman.log")
123+
. " --error-log=" . $config->getRoot("var/logs/starman_error.log")
124+
. " --workers=" . $config->get("starman/workers")
125+
;
125126
`$cmd`; # catch command line output
126-
while ($count < 10 && $success == 0) {
127+
while ($count++ < 10 && !$success) {
127128
sleep(1);
128129
eval {$success = $self->ping };
129-
$count++;
130130
}
131131
return $success;
132132
}
@@ -146,30 +146,19 @@ sub stop {
146146
my $count = 0;
147147
my $success = 1;
148148
my $config = $self->wreConfig;
149-
$config->set("wreMonitor/modperlAdministrativelyDown", 1);
149+
$config->set("wreMonitor/starmanAdministrativelyDown", 1);
150150
my $host = WRE::Host->new(wreConfig=>$config);
151-
unless ($config->get("apache/modperlPort") > 1024 || $host->isPrivilegedUser) {
151+
unless ($config->get("starman/port") > 1024 || $host->isPrivilegedUser) {
152152
croak "You are not an administrator on this machine so you cannot stop services with ports 1-1024.";
153153
}
154-
my $cmd = "";
155-
if ($host->getOsName eq "windows") {
156-
$cmd = "net stop WREmodperl";
157-
}
158-
else {
159-
$cmd = $config->getRoot("/prereqs/bin/apachectl")." -f ".$config->getRoot("/etc/modperl.conf")
160-
." -D WRE-modperl -k stop";
161-
}
162-
`$cmd`; # catch command line output
163-
while ($count < 10 && $success == 1) {
154+
#kill "TERM", 0;
155+
while ($count++ < 10 && $success) {
156+
sleep(1);
164157
eval { $success = $self->ping };
165-
$count++;
166158
}
167159
return $success;
168160
}
169161

170-
171-
172-
173162
} # end inside out object
174163

175164
1;

‎wre/sbin/backup.pl

+33-225
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use WRE::Mysql;
1919
use Getopt::Long ();
2020
use Pod::Usage ();
21+
use 5.010;
2122

2223
my $config = WRE::Config->new;
2324
my $util = WRE::File->new(wreConfig => $config);
@@ -32,74 +33,9 @@
3233
# are backups enabled
3334
exit unless $config->get("backup/enabled");
3435

35-
rotateBackupFiles($config);
3636
backupMysql($config);
37-
backupDomains($config);
38-
backupWebgui($config);
39-
backupWre($config);
40-
backupCustom($config);
4137
runExternalScripts($config);
42-
compressBackups($config);
4338
copyToRemote($config);
44-
#removeBackupFiles($config);
45-
46-
#-------------------------------------------------------------------
47-
sub backupCustom {
48-
my $config = shift;
49-
50-
return undef unless $config->get("backup/items/custom");
51-
52-
my $backupDir = dir($config->get("backup/path"));
53-
my $customFile = $config->getWebguiRoot("/sbin/preload.custom");
54-
open FILE, $customFile or die $!;
55-
my @lines = <FILE>;
56-
my @customDirs;
57-
foreach my $line (@lines) {
58-
if ($line =~ /^\//) {
59-
my $backupFile = join("",map { ucfirst($_) } split /\//, $line);
60-
chomp $backupFile;
61-
62-
eval { $util->tar(
63-
file => $backupDir->file($backupFile.".tar")->stringify,
64-
stuff => [$line],
65-
absPath => 1,
66-
)};
67-
print $@."\n" if ($@);
68-
}
69-
else {
70-
next;
71-
}
72-
}
73-
}
74-
75-
#-------------------------------------------------------------------
76-
sub backupDomains {
77-
my $config = shift;
78-
79-
# should we run?
80-
return undef unless $config->get("backup/items/domainsFolder");
81-
82-
my $domainsRoot = dir($config->getDomainRoot);
83-
84-
# get domains to backup
85-
opendir(DIR, $domainsRoot->stringify);
86-
my @domains = readdir(DIR);
87-
closedir(DIR);
88-
89-
# create tarballs
90-
my $tar = $config->get("tar");
91-
my $backupDir = dir($config->get("backup/path"));
92-
my $excludes = $config->getRoot("/etc/backup.exclude");
93-
foreach my $domain (@domains) {
94-
next if ($domain eq "." || $domain eq ".." || $domain eq "demo");
95-
eval {$util->tar(
96-
exclude => $excludes,
97-
file => $backupDir->file($domain.".tar")->stringify,
98-
stuff => [$domainsRoot->subdir($domain)->stringify],
99-
)};
100-
print $@."\n" if ($@);
101-
}
102-
}
10339

10440
#-------------------------------------------------------------------
10541
sub backupMysql {
@@ -143,183 +79,55 @@ sub backupMysql {
14379
}
14480

14581
#-------------------------------------------------------------------
146-
sub backupWebgui {
147-
my $config = shift;
148-
149-
# should we run?
150-
return undef unless $config->get("backup/items/webgui");
151-
152-
# create tarball
153-
eval {$util->tar(
154-
exclude => $config->getRoot("/etc/backup.exclude"),
155-
file => file($config->get("backup/path"), "webgui.tar")->stringify,
156-
stuff => [$config->getWebguiRoot],
157-
)};
158-
print $@."\n" if ($@);
159-
}
160-
161-
#-------------------------------------------------------------------
162-
sub backupWre {
163-
my $config = shift;
164-
my $full = $config->get("backup/items/fullWre");
165-
my $small = $config->get("backup/items/smallWre");
166-
167-
# should we run?
168-
return undef unless ($full || $small);
169-
170-
# whole thing or just configs?
171-
my $pathToBackup = ($full) ? $config->getRoot : $config->getRoot("/etc");
172-
173-
# create tarball
174-
eval {$util->tar(
175-
exclude => $config->getRoot("/etc/backup.exclude"),
176-
file => file($config->get("backup/path"), "wre.tar")->stringify,
177-
stuff => [$pathToBackup],
178-
)};
179-
print $@."\n" if ($@);
180-
}
181-
182-
#-------------------------------------------------------------------
183-
sub compressBackups {
82+
sub backupFiles {
18483
my $config = shift;
185-
my $gzip = file($config->get("gzip"))->stringify;
186-
my $backupDir = dir($config->get("backup/path"));
187-
188-
# compress files
189-
system("$gzip -f ".$backupDir->file("*.sql")->stringify);
190-
system("$gzip -f ".$backupDir->file("*.tar")->stringify);
84+
my $paths = $config->get("backup/items");
85+
my $backupDir = $config->get("backup/path");
86+
foreach my $path (@{ $paths }) {
87+
say "rsyncing $path locally...";
88+
system ("nice rsync -av --exclude=logs --exclude=mysqldata $path $backupDir/backup");
89+
}
19190
}
19291

19392
#-------------------------------------------------------------------
19493
sub copyToRemote {
19594
my $config = shift;
19695
# should we run?
197-
return undef unless $config->get("backup/ftp/enabled");
198-
my $protocol = $config->get("backup/ftp/protocol") || "ftp";
199-
200-
my $now = time;
201-
my $passive = $config->get("backup/ftp/usePassiveTransfers");
202-
my $host = $config->get("backup/ftp/hostname");
203-
my $path = $config->get("backup/ftp/path");
204-
my $user = $config->get("backup/ftp/user");
205-
my $pass = $config->get("backup/ftp/password");
206-
my $rotations = $config->get("backup/ftp/rotations");
207-
my $extraCommands = '';
208-
# don't validate local cert
209-
if ($protocol eq 'https') {
210-
$extraCommands .= 'set ssl:verify-certificate off; ';
211-
}
96+
return undef unless $config->get("backup/rsync/enabled");
21297

213-
# a little massage
214-
$path = ($path eq "/") ? "." : $path; # never let it look at the root of the server
98+
my $user = $config->get("backup/rsync/user");
99+
my $host = $config->get("backup/rsync/hostname");
100+
my $ACCOUNT = $user . '@' . $host;
101+
my $rotations = $config->get("backup/rsync/rotations");
102+
my $remote_path = $config->get("backup/rsync/remote_path");
103+
my $paths = $config->get("backup/items");
104+
my $backupDir = $config->get("backup/path");
215105

216106
# get old versions
217107
if ($rotations > 1) {
218-
my $cmd = $config->getRoot('/prereqs/bin/lftp').' -e "cd '.$path.'; ls; exit" -u '.$user.','.$pass.' '.$protocol.'://'.$host.'/';
219-
my @dirs = ();
220-
if (open my $pipe, $cmd.'|') {
221-
while (my $line = <$pipe>) {
222-
chomp $line;
223-
if ($line =~ m/^([drxws-]+)\s+\d+\s+\w+\s+\w+\s+\d+\s+\w+\s+\d+\s+\d+:\d{2}\s+(\w+)/ || $line =~ m/^([drxws-]+)\s+--\s+(\w+)/) {
224-
my ($privs, $name) = ($1, $2);
225-
# skip non-backup directories
226-
next unless ($privs =~ m/^d/);
227-
next unless ($name =~ m/^\d+$/);
228-
push @dirs, $name;
229-
}
230-
}
231-
close $pipe;
108+
say "Removing last remote backup files...";
109+
my $cmd = "ssh $ACCOUNT rm -rf $remote_path/backup.$rotations";
110+
system($cmd);
111+
112+
# rotate backups except for the last one
113+
for (my $i=$rotations; $i > 1; $i--) {
114+
my $prev= $i - 1;
115+
say "Rotating old remote backup $i...";
116+
$cmd = "ssh $ACCOUNT mv $remote_path/backup.$prev $remote_path/backup.$i";
117+
system($cmd);
232118
}
233-
else {
234-
die "Couldn't connect to backup server.";
235-
}
236-
237-
# do rotations
238-
@dirs = sort(@dirs);
239-
my $i = scalar(@dirs);
240-
foreach my $dir (@dirs) {
241-
last if ($i < $rotations);
242-
system($config->getRoot('/prereqs/bin/lftp').' -e "rm -r -f '.$path.'/'.$dir.'; exit" -u '.$user.','.$pass.' '.$protocol.'://'.$host);
243-
$i--;
244-
}
245-
}
246-
247-
# deal with passive transfers
248-
if ($protocol eq 'ftp' && !$passive) {
249-
$extraCommands .= "set ftp:passive-mode off; ";
250-
}
251-
252-
# don't do the rotations folder if we aren't using rotations
253-
if ($rotations > 1) {
254-
$extraCommands .= 'mkdir '.$path.'/'.$now.'; mput -O '.$path.'/'.$now;
255-
}
256-
else {
257-
$extraCommands .= 'mput -O '.$path;
119+
say "Copying first backup to 1...";
120+
$cmd = "ssh $ACCOUNT cp -al $remote_path/backup $remote_path/backup.1";
121+
system($cmd);
258122
}
259123

260124
# do transfer
261-
my $cmd = $config->getRoot('/prereqs/bin/lftp').' -e "'.$extraCommands.' '.file($config->get("backup/path"),'/*.gz')->stringify.'; exit" -u '.$user.','.$pass.' '.$protocol.'://'.$host;
262-
system($cmd);
263-
}
264-
265-
#-------------------------------------------------------------------
266-
sub removeBackupFiles {
267-
my $config = shift;
268-
my $backupDir = dir($config->get("backup/path"));
269-
my $rotations = $config->get("backup/rotations");
270-
if ($rotations == 0 ||$rotations == 1) {
271-
opendir(DIR,$backupDir->stringify);
272-
my @files = readdir(DIR);
273-
closedir(DIR);
274-
foreach my $file (@files) {
275-
if ($rotations eq "0") {
276-
$backupDir->file($file)->remove;
277-
}
278-
elsif ($file =~ /(.*\.)1/ ) {
279-
$backupDir->file($file)->remove;
280-
}
281-
}
125+
say "Moving new data over...";
126+
foreach my $path (@{ $paths }) {
127+
say "rsyncing $path remotely...";
128+
system ("rsync -av --chmod=u+rwx --exclude=logs --exclude=mysqldata $path $ACCOUNT:$remote_path/backup");
282129
}
283130
}
284-
#-------------------------------------------------------------------
285-
sub rotateBackupFiles {
286-
my $config = shift;
287-
my $backupDir = dir($config->get("backup/path"));
288-
my $rotations = $config->get("backup/rotations") - 1; # .gz counts as 1
289-
290-
# get the list of files
291-
opendir(DIR,$backupDir->stringify);
292-
my @files = readdir(DIR);
293-
closedir(DIR);
294-
295-
# rotate and delete old files
296-
for (my $i = $rotations; $i > 0; $i--) {
297-
foreach my $file (@files) {
298-
299-
# only look at files where their extension is a specific digit
300-
if ($file =~ /(.*\.)$i$/) {
301-
my $filefront = $1;
302-
303-
# get rid of oldest files
304-
if ($i == $rotations) {
305-
$backupDir->file($file)->remove;
306-
}
307-
308-
# rotate younger files
309-
else {
310-
rename $backupDir->file($file)->stringify, $backupDir->file($filefront.($i+1))->stringify;
311-
}
312-
}
313-
}
314-
}
315-
316-
# rotate new files
317-
foreach my $file (@files) {
318-
if ($file =~ /\.gz$/) {
319-
rename $backupDir->file($file)->stringify, $backupDir->file($file.".1")->stringify;
320-
}
321-
}
322-
}
323131

324132
#-------------------------------------------------------------------
325133
sub runExternalScripts {

‎wre/sbin/services/freebsd/webgui

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ name="webgui"
88
rcvar=`set_rcvar`
99

1010
extra_commands="help startweb stopweb restartweb\
11-
startmodperl stopmodperl restartmodperl\
11+
startstarman stopstarman restartstarman\
1212
startnginx stopnginx restartnginx\
1313
startmysql stopmysql restartmysql\
1414
startspectre stopspectre restartspectre\
1515
"
1616
help_cmd="${name}_help"
1717
start_cmd="${name}_start"
1818
stop_cmd="${name}_stop"
19-
startweb_cmd="${startmodperl_cmd}; ${startnginx_cmd}"
20-
stopweb_cmd="${stopnginx_cmd}; ${stopmodperl_cmd}"
19+
startweb_cmd="${startstarman_cmd}; ${startnginx_cmd}"
20+
stopweb_cmd="${stopnginx_cmd}; ${stopstarman_cmd}"
2121
restartweb_cmd="${stopweb_cmd}; ${startweb_cmd}"
2222
startnginx_cmd="${name}_startnginx"
2323
stopnginx_cmd="${name}_stopnginx"
2424
restartnginx_cmd="${stopnginx_cmd}; ${startnginx_cmd}"
25-
startmodperl_cmd="${name}_startmodperl"
26-
stopmodperl_cmd="${name}_stopmodperl"
27-
restartmodperl_cmd="${stopmodperl_cmd}; ${startmodperl_cmd}"
25+
startstarman_cmd="${name}_startstarman"
26+
stopstarman_cmd="${name}_stopstarman"
27+
restartstarman_cmd="${stopstarman_cmd}; ${startstarman_cmd}"
2828
startmysql_cmd="${name}_startmysql"
2929
stopmysql_cmd="${name}_stopmysql"
3030
restartmysql_cmd="${stopmysql_cmd}; ${startmysql_cmd}"
@@ -41,7 +41,7 @@ webgui_help() {
4141
echo " -- Start/stop all WRE services"
4242
echo " $0 { startweb | stopweb | restartweb }"
4343
echo " -- Start/stop both Apache services"
44-
echo " $0 { startmodperl | stopmodperl | restartmodperl }"
44+
echo " $0 { startstarman | stopstarman | restartstarman }"
4545
echo " -- Start/stop mod_perl (WebGUI) Apache service"
4646
echo " $0 { startnginx | stopnginx | restartnginx }"
4747
echo " -- Start/stop mod_proxy Apache service"
@@ -60,12 +60,12 @@ webgui_stop() {
6060
wreservice.pl --quiet --stop all
6161
}
6262

63-
webgui_startmodperl() {
64-
wreservice.pl --quiet --start modperl
63+
webgui_startstarman() {
64+
wreservice.pl --quiet --start starman
6565
}
6666

67-
webgui_stopmodperl() {
68-
wreservice.pl --quiet --stop modperl
67+
webgui_stopstarman() {
68+
wreservice.pl --quiet --stop starman
6969
}
7070

7171
webgui_startnginx() {

‎wre/sbin/services/redhat/webgui

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ case "$1" in
3434
restartweb)
3535
/data/wre/sbin/wreservice.pl --quiet --restart web
3636
;;
37-
startmodperl)
38-
/data/wre/sbin/wreservice.pl --quiet --start modperl
37+
startstarman)
38+
/data/wre/sbin/wreservice.pl --quiet --start starman
3939
;;
40-
stopmodperl)
41-
/data/wre/sbin/wreservice.pl --quiet --stop modperl
40+
stopstarman)
41+
/data/wre/sbin/wreservice.pl --quiet --stop starman
4242
;;
43-
restartmodperl)
44-
/data/wre/sbin/wreservice.pl --quiet --restart modperl
43+
restartstarman)
44+
/data/wre/sbin/wreservice.pl --quiet --restart starman
4545
;;
4646
startnginx)
4747
/data/wre/sbin/wreservice.pl --quiet --start nginx
@@ -66,7 +66,7 @@ case "$1" in
6666
echo $"Usage:"
6767
echo $" $0 { start | stop | restart }"
6868
echo $" $0 { startweb | stopweb | restartweb }"
69-
echo $" $0 { startmodperl | stopmodperl | restartmodperl }"
69+
echo $" $0 { startstarman | stopstarman | restartstarman }"
7070
echo $" $0 { startnginx | stopnginx | restartnginx }"
7171
echo $" $0 { startmysql | stopmysql | restartmysql }"
7272
echo $" $0 { startspectre | stopspectre | restartspectre }"

‎wre/sbin/services/redhat/wre-apache

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# chkconfig: 2345 90 60
3-
# description: Start and stop WebGUI (WRE) Apache
4-
# processname: wreapache
3+
# description: Start and stop WebGUI (WRE) Web services (starman and nginx)
4+
# processname: wreweb
55

66
. /data/wre/sbin/setenvironment.sh
77

@@ -16,14 +16,14 @@ case "$1" in
1616
restart)
1717
/data/wre/sbin/wreservice.pl --quiet --restart web
1818
;;
19-
startmodperl)
20-
/data/wre/sbin/wreservice.pl --quiet --start modperl
19+
startstarman)
20+
/data/wre/sbin/wreservice.pl --quiet --start starman
2121
;;
22-
stopmodperl)
23-
/data/wre/sbin/wreservice.pl --quiet --stop modperl
22+
stopstarman)
23+
/data/wre/sbin/wreservice.pl --quiet --stop starman
2424
;;
25-
restartmodperl)
26-
/data/wre/sbin/wreservice.pl --quiet --restart modperl
25+
restartstarman)
26+
/data/wre/sbin/wreservice.pl --quiet --restart starman
2727
;;
2828
startnginx)
2929
/data/wre/sbin/wreservice.pl --quiet --start nginx
@@ -35,10 +35,10 @@ case "$1" in
3535
/data/wre/sbin/wreservice.pl --quiet --restart nginx
3636
;;
3737
*)
38-
echo $"WRE Apache Service Controller"
38+
echo $"WRE Web Service Controller"
3939
echo $"Usage:"
4040
echo $" $0 { start | stop | restart }"
41-
echo $" $0 { startmodperl | stopmodperl | restartmodperl }"
41+
echo $" $0 { startstarman | stopstarman | restartstarman }"
4242
echo $" $0 { startnginx | stopnginx | restartnginx }"
4343
echo $" $0 { startweb | stopweb | restartweb }"
4444
exit 1

‎wre/sbin/wre.conf.pod

+11-31
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,26 @@ The configuration file is stored as JSON.
1515
=head2 BACKUP
1616

1717
"backup" : {
18-
"compress" : null,
1918
"enabled" : "1",
2019
"externalScripts" : [],
21-
"ftp" : {
20+
"rsync" : {
2221
"enabled" : "1",
2322
"hostname" : "my remote backup host",
24-
"password" : "sekrit",
2523
"path" : "/remote_backups",
26-
"protocol" : "sftp",
2724
"rotations" : "1",
28-
"usePassiveTransfers" : "1",
2925
"user" : "username"
3026
},
31-
"items" : {
32-
"domainsFolder" : "1",
33-
"fullWre" : "0",
34-
"mysql" : "1",
35-
"smallWre" : "1",
36-
"webgui" : "1"
27+
"items" : { ##List of directories to backup, wildcards are okay
28+
"/data/domains", ##All domain files
29+
"/data/WebGUI", ##All of WebGUI, including etc and sbin
30+
"/data/backup/*.sql.gz", ##All database dumps
31+
"/data/wre/etc" ##All WRE configuration files
3732
},
3833
"mysql" : {
3934
"password" : "also_sekrit",
4035
"user" : "other_name"
4136
},
4237
"path" : "/backup",
43-
"rotations" : "15"
4438
},
4539

4640
=over 4
@@ -55,19 +49,17 @@ Optional value that can be set to run external script during backup.
5549

5650
=item B<items>
5751

58-
The parts of WebGUI that should be backupped (domainsFolder,fullWre,mysql,smallWre(only configfiles),webgui), set the according values to non-zero if these parts should be backupped.
52+
A list of directories that should be backed up. They are copied to B<path> and optionally transferred remotely.
5953

6054
=item B<path>
6155

6256
The path to the directory on the WebGUI host, where the backups are stored.
6357

64-
=item B<rotations>
65-
66-
The number of rotations that should be stored on the WebGUI host.
67-
6858
=back
6959

70-
=head3 FTP OPTIONS
60+
=head3 RSYNC OPTIONS
61+
62+
Rsync based backups require that private/public key-pair be setup for transfers.
7163

7264
=over 4
7365

@@ -79,26 +71,14 @@ This value has to be non-zero to enable remote backups
7971

8072
The hostname of the host where the remote backups will be stored
8173

82-
=item B<password>
83-
84-
The password of the backup user on the remote host.
85-
8674
=item B<path>
8775

8876
The path on the remote host where the backups should be stored. Backup user must have write access.
8977

90-
=item B<protocol>
91-
92-
The protocol that is used to transfer backups to the remote host. Valid values are ftp, sftp, http, https and fish.
93-
9478
=item B<rotations>
9579

9680
The number of rotations that should be stored on the remote host.
9781

98-
=item B<usePassiveTransfers>
99-
100-
This vale can be set to zero to use non-passive ftp transfers
101-
10282
=item B<user>
10383

10484
The user on the remote host
@@ -107,6 +87,6 @@ The user on the remote host
10787

10888
=head1 AUTHOR
10989

110-
Copyright 2001-2009 Plain Black Corporation.
90+
Copyright 2001-2011 Plain Black Corporation.
11191

11292
=cut

‎wre/sbin/wreconsole.pl

+4-9
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ sub www_setup {
11901190
print $socket $crlf;
11911191
print $socket "<h1>Configuring Your WRE Server</h1>$crlf";
11921192
$file->makePath($config->getRoot("/var/logs"));
1193+
$file->makePath($config->getRoot("/var/run"));
11931194

11941195
# config file
11951196
print $socket "<p>Updating WRE config.</p><blockquote>$crlf";
@@ -1304,27 +1305,21 @@ sub www_setup {
13041305
}
13051306
$modperlVars{osName} = $host->getOsName;
13061307
$modperlVars{devOnly} = $collected->{devOnly};
1307-
$file->copy($config->getRoot("/var/setupfiles/modperl.conf"),
1308-
$config->getRoot("/etc/modperl.conf"),
1309-
{ force => 1, templateVars=>\%modperlVars });
13101308
$file->copy($config->getRoot("/var/setupfiles/nginx.conf"),
13111309
$config->getRoot("/etc/nginx.conf"),
13121310
{ force => 1, templateVars=>{osName=>$host->getOsName} });
13131311
$file->copy($config->getRoot("/var/setupfiles/mime.types"),
13141312
$config->getRoot("/etc/mime.types"),
13151313
{ force => 1 });
1316-
$file->copy($config->getRoot("/var/setupfiles/modperl.pl"),
1317-
$config->getRoot("/etc/modperl.pl"),
1318-
{ force => 1 });
1319-
$file->copy($config->getRoot("/var/setupfiles/modperl.template"),
1320-
$config->getRoot("/var/modperl.template"),
1321-
{ force => 1 });
13221314
$file->copy($config->getRoot("/var/setupfiles/nginx.template"),
13231315
$config->getRoot("/var/nginx.template"),
13241316
{ force => 1 });
13251317
$file->copy($config->getRoot("/var/setupfiles/awstats.template"),
13261318
$config->getRoot("/var/awstats.template"),
13271319
{ force => 1 });
1320+
$file->copy($config->getRoot("/var/setupfiles/wre.logrotate"),
1321+
$config->getRoot("/var/wre.logrotate"),
1322+
{ force => 1 });
13281323
print $socket "</blockquote>$crlf";
13291324

13301325
# configuring webgui

‎wre/t/File.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ is(-f file($recursiveDir2."/ab/a")->stringify, 1, "recursive copy() subdirectory
8787

8888

8989
# processTemplate
90-
my $content = "This is my modperl port: [% modperlPort %].";
91-
my $evaluatedContent = "This is my modperl port: 8081.";
90+
my $content = "This is my starmsn port: [% starmanPort %].";
91+
my $evaluatedContent = "This is my starman port: 8081.";
9292
is(${$file->processTemplate(\$content)}, $evaluatedContent, "processTemplate() with scalarref");
9393

9494

‎wre/var/setupfiles/modperl.conf

-824
This file was deleted.

‎wre/var/setupfiles/modperl.pl

-7
This file was deleted.

‎wre/var/setupfiles/modperl.template

-13
This file was deleted.

‎wre/var/setupfiles/modproxy.conf

-823
This file was deleted.

‎wre/var/setupfiles/modproxy.template

-82
This file was deleted.

‎wre/var/setupfiles/my.cnf

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ ft_min_word_len=2
1414
wait_timeout=600
1515
query_cache_size=32M
1616
default-character-set=utf8
17-
port=[% databasePort %]
18-
[% IF osName == "windows" %]
19-
pid-file=c:\data\wre\var\mysql.pid
20-
datadir=c:\data\wre\var\mysqldata
21-
lower_case_table_names=2
22-
[% END %]
17+
port=[% config.get(database/port) %]
2318
[% IF osName == "darwin" %]
2419
lower_case_table_names=2
2520
[% END %]

‎wre/var/setupfiles/nginx.conf

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
user [% wreUser %];
2+
worker_processes 10;
3+
4+
error_log [% config.getRoot %]/var/logs/nginx_error.log;
5+
6+
pid [% config.getRoot %]/var/run/nginx.pid;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include mime.types;
14+
default_type application/octet-stream;
15+
16+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17+
'$status $body_bytes_sent "$http_referer" '
18+
'"$http_user_agent" "$http_x_forwarded_for"';
19+
20+
sendfile on;
21+
22+
keepalive_timeout 65;
23+
24+
server_tokens off;
25+
26+
gzip on;
27+
gzip_types text/plain text/css application/json application/json-rpc application/x-javascript text/xml application/xml application/xml+rss text/javascript;
28+
gzip_comp_level 9;
29+
30+
location ^~ /extras/ {
31+
root [% webguiRoot %]/www/extras;
32+
expires 36000
33+
}
34+
35+
location ~ /.* {
36+
proxy_pass http://localhost:[% config.get(starman/port) %];
37+
}
38+
39+
##Include per-server vhost configuration files.
40+
include [% config.getRoot %]/etc/*.nginx
41+
42+
}

‎wre/var/setupfiles/nginx.template

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
server {
2+
listen [% modproxyPort %];
3+
server_name [% sitename %] [% domain %];
4+
access_log [% domainRoot %]/[% sitename %]/logs/access.log combined
5+
6+
client_max_body_size 20M;
7+
proxy_set_header X-Real-IP $remote_addr;
8+
proxy_set_header Host $host;
9+
10+
# block IIS related attacks from getting to WebGUI
11+
location = /^scripts/ {
12+
return 400
13+
}
14+
15+
location = /^default.ida/ {
16+
return 400
17+
}
18+
19+
location = /_vti_bin/ {
20+
return 400
21+
}
22+
23+
location = /_mem_bin/ {
24+
return 400
25+
}
26+
27+
# proxy webgui pages
28+
#ProxyPreserveHost On
29+
#RewriteRule ^/(.*) http://127.0.0.1:[% modperlPort %]/$1 [P]
30+
}
31+
32+
# Uncomment the following lines to enable SSL for this host. Also,
33+
# change the 10.0.0.1 to the IP address you wish to bind the SSL host
34+
# to.
35+
36+
#server {
37+
# listen 443;
38+
# server_name [% sitename %] [% domain %];
39+
# access_log [% domainRoot %]/[% sitename %]/logs/access.log combined
40+
#
41+
# client_max_body_size 20M;
42+
# proxy_set_header X-Real-IP $remote_addr;
43+
# proxy_set_header Host $host;
44+
#
45+
# # block IIS related attacks from getting to WebGUI
46+
# location = /^scripts/ {
47+
# return 400
48+
# }
49+
#
50+
# location = /^default.ida/ {
51+
# return 400
52+
# }
53+
#
54+
# location = /_vti_bin/ {
55+
# return 400
56+
# }
57+
#
58+
# location = /_mem_bin/ {
59+
# return 400
60+
# }
61+
#
62+
# # For chained certificates, concatenate all the certs together, starting with the
63+
# # site certificate and then the chained certificates
64+
# ssl_certificate [% domainRoot %]/[% sitename %]/certs/server.crt
65+
# ssl_certificate_key [% domainRoot %]/[% sitename %]/certs/server.key
66+
#
67+
#}

‎wre/var/setupfiles/wre.conf

+27-30
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,20 @@
1717
"port" : 3306
1818
},
1919

20-
# apache
21-
"apache" : {
20+
# starman
21+
"starman" : {
2222
"maxMemory" : 100000000,
2323
"connectionTimeout" : 30,
2424
"defaultHostname" : "localhost",
25-
"nginxPort" : 80,
26-
"modperlPort" : 8081
25+
"port" : 8081,
26+
"workers" : 10
27+
},
28+
29+
# nginx
30+
"nginx" : {
31+
"connectionTimeout" : 30,
32+
"defaultHostname" : "localhost",
33+
"port" : 80,
2734
},
2835

2936
# utilities
@@ -66,16 +73,16 @@
6673
"wreMonitor" : {
6774
"notify" : ["root@localhost"],
6875
"mysqlAdministrativelyDown" : 1,
69-
"modperlAdministrativelyDown" : 1,
76+
"starmanAdministrativelyDown" : 1,
7077
"nginxAdministrativelyDown" : 1,
7178
"spectreAdministrativelyDown" : 1,
7279
"items" : {
73-
"maxTotalWorkflows" : 1000,
74-
"maxWorkflowsPerSite" : 100,
75-
"maxWorkflowPriority" : 100,
76-
"nginx" : 1,
77-
"modperl" : 1,
78-
"runaway" : 1,
80+
"maxTotalWorkflows" : 1000,
81+
"maxWorkflowsPerSite" : 100,
82+
"maxWorkflowPriority" : 100,
83+
"nginx" : 1,
84+
"starman" : 1,
85+
"runaway" : 1,
7986
"mysql" : 1,
8087
"spectre" : 1
8188
}
@@ -85,27 +92,22 @@
8592
"backup" : {
8693
"enabled" : 0,
8794
"path" : "/backup",
88-
"rotations" : 7,
8995
"mysql" : {
9096
"user" : "backup",
9197
"password" : "xxxxxxx"
9298
},
93-
"items" : {
94-
"mysql" : 1,
95-
"fullWre" : 0,
96-
"smallWre" : 1,
97-
"domainsFolder" : 1,
98-
"webgui" : 1
99-
},
99+
"items" : [ ##List of directories, wildcards are okay
100+
"/data/domains", ##All domain files
101+
"/data/WebGUI", ##All of WebGUI, including etc and sbin
102+
"/data/backup/*.sql.gz", ##All database dumps
103+
"/data/wre/etc" ##All WRE configuration files
104+
],
100105
"externalScripts" : [],
101-
"ftp" : {
106+
"rsync" : {
102107
"enabled" : 0,
103-
"usePassiveTransfers" : 1,
104108
"rotations" : 3,
105-
"hostname" : "ftp.example.com",
106-
"user" : "ftpuser",
107-
"protocol" : "ftp",
108-
"password" : "xxxxxx",
109+
"hostname" : "rsync.example.com",
110+
"user" : "rsyncuser",
109111
"path" : "."
110112
}
111113
},
@@ -124,11 +126,6 @@
124126
}
125127
},
126128

127-
# logs
128-
"logs" : {
129-
"rotations" : 3
130-
},
131-
132129
# web stats
133130
"webstats" : {
134131
"hostname" : "webstats.example.com",

‎wre/var/setupfiles/wre.logrotate

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#Rotate TGC log
2+
3+
##nginx and access logs
4+
[% config.getRoot %]/var/logs/nginx_error.log /data/domains/*/logs/access.log {
5+
notifempty
6+
daily
7+
rotate 7
8+
missingok
9+
compress
10+
sharedscripts
11+
postrotate
12+
[% config.getRoot %]/prereqs/bin/perl [% config.getRoot %]/sbin/wreservice.pl --restart nginx
13+
endscript
14+
}
15+
16+
##webgui and starman
17+
[% config.getRoot %]/var/logs/webgui.log [% config.getRoot %]/var/logs/starman*.log {
18+
notifempty
19+
daily
20+
rotate 7
21+
missingok
22+
compress
23+
sharedscripts
24+
postrotate
25+
[% config.getRoot %]/prereqs/bin/perl [% config.getRoot %]/sbin/wreservice.pl --restart starman
26+
endscript
27+
}
28+
29+
##wremonitor
30+
[% config.getRoot %]/var/logs/wremonitor.log
31+
notifempty
32+
daily
33+
rotate 7
34+
missingok
35+
compress
36+
}
37+

0 commit comments

Comments
 (0)
Please sign in to comment.