Skip to content

Commit

Permalink
Item14288: Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Dec 4, 2017
2 parents 74c5a79 + 9525c59 commit 121f6e3
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 22 deletions.
17 changes: 13 additions & 4 deletions FastCGIEngineContrib/bin/foswiki.fcgi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2008-2015 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
# Copyright (C) 2008-2017 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
# contributors. Foswiki contributors are listed in the AUTHORS file in the root
# of Foswiki distribution.
#
Expand Down Expand Up @@ -44,7 +44,13 @@ our ($dir) = Cwd::cwd() =~ /^(.*)$/;

my @argv = @ARGV;

my ( $listen, $nproc, $max, $size, $check, $pidfile, $manager, $detach, $help, $quiet );
my (
$listen, $nproc, $max, $size, $check, $pidfile,
$manager, $detach, $help, $quiet
);

my $pname = 'foswiki'; # Default process name.

GetOptions(
'listen|l=s' => \$listen,
'nproc|n=i' => \$nproc,
Expand All @@ -56,13 +62,14 @@ GetOptions(
'daemon|d' => \$detach,
'help|?' => \$help,
'quiet|q' => \$quiet,
'pname|a=s' => \$pname,
);

pod2usage(1) if $help;

# untaint
if (defined $pidfile) {
$pidfile =~ /^(.*)$/ and $pidfile = $1;
if ( defined $pidfile ) {
$pidfile =~ /^(.*)$/ and $pidfile = $1;
}

@ARGV = @argv;
Expand All @@ -79,6 +86,7 @@ $Foswiki::engine->run(
max => $max,
size => $size,
check => $check,
pname => $pname,
}
);

Expand All @@ -99,6 +107,7 @@ foswiki.fcgi [options]
-d --daemon Detach from terminal and keeps running as a daemon
-q --quiet Disable notification messages
-? --help Display this help and exits
-N --pname Process name to display in ps output for the process-manager task.
Note:
FCGI manager class defaults to Foswiki::Engine::FastCGI::ProcManager, a
Expand Down
13 changes: 9 additions & 4 deletions FastCGIEngineContrib/data/System/FastCGIEngineContrib.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1497953719" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1512262721" format="1.1" version="1"}%
---+!! <nop>FastCGI Engine Contrib
%$SHORTDESCRIPTION%

Expand Down Expand Up @@ -74,11 +74,14 @@ mod_fastcgi resources
<div class="foswikiHelp">
%X% It is strongly recommended that users work from
Foswiki:Support.ApacheConfigGenerator to create initial Apache configurations.
This config generator is comprehensive and well tested.
This config generator is comprehensive and well tested.</div>

There is one important parameter which should be consistent with the largest ATTACHFILESIZELIMIT of any web. =FcgidMaxRequestLen= must be large enough to
permit upload of the largest possible attachment, or the upload will fail with a 500 status. Be sure the =FcgidMaxRequestLen= is larger so that the user will get a
friendly error message from Foswiki. The default limit on recent Apache releases is 131072 bytes. It is _not_ possible to override this in a =.htaccess= file.

Foswiki also ships with an example apache configuration, and example
=.htaccess= files which include Fcgi example configurations.
</div>

---+++ Lighttpd
<div class="foswikiHelp">
Expand Down Expand Up @@ -232,6 +235,8 @@ After the update, each process will still serve one more request before reloadin
---++ Info

| Change History: | |
| 02 Dec 2017 | (1.05) Foswikitask:Item14532 - Allow process name to be overridden when running as started task.<br/>\
Foswikitask:Item11491 - Document relationship between =ATTACHFILESIZELIMIT= and =FcgidMaxRequestLen=. |
| 21 May 2017 | (1.04) Foswikitask:Item14346 - Fix issues in the systemd service file. Improve documentation.<br/>\
Foswikitask:Item14402 - Fix default Foswiki root location. along with more doc improvements. |
| 04 Oct 2016 | (1.03) Foswikitask:Item13883 - Documentation updates, Foswikitask:Item14086 - Add a systemd example service file. |
Expand All @@ -252,7 +257,7 @@ After the update, each process will still serve one more request before reloadin

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="[[Foswiki:Main.GilmarSantosJr][Gilmar Santos Jr]]"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2008-2016 Gilmar Santos Jr and Foswiki Contributors"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2008-2017 Gilmar Santos Jr and Foswiki Contributors"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/%$ROOTMODULE%"}%
%META:FIELD{name="License" title="License" value="[[http://www.gnu.org/copyleft/gpl.html][GPL (Gnu General Public License)]]"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package Foswiki::Contrib::FastCGIEngineContrib;
use strict;
use warnings;

our $VERSION = '1.04';
our $RELEASE = '21 May 2017';
our $VERSION = '1.05';
our $RELEASE = '02 Dec 2017';
our $SHORTDESCRIPTION = 'Permits Foswiki to be executed with FastCGI';

1;
5 changes: 4 additions & 1 deletion FastCGIEngineContrib/lib/Foswiki/Engine/FastCGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ sub run {
n_processes => $args->{nproc},
pid_fname => $args->{pidfile},
quiet => $args->{quiet},
pm_title => ( $args->{pname} || 'foswiki' ) . '-fcgi-pm',

max_requests =>
( defined $args->{max} ? $args->{max} : $maxRequests ),
Expand All @@ -103,6 +104,8 @@ sub run {
);

$manager->pm_manage();
$manager->pm_change_process_name(
( $args->{pname} || 'foswiki' ) . '-fcgi' );
}
else { # No ProcManager

Expand Down Expand Up @@ -263,7 +266,7 @@ __END__
FastCGI Runtime Engine of Foswiki - The Free and Open Source Wiki,
http://foswiki.org/
Copyright (C) 2008-2015 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
Copyright (C) 2008-2017 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
contributors. Foswiki contributors are listed in the AUTHORS file in the root
of Foswiki distribution.
Expand Down
16 changes: 7 additions & 9 deletions FastCGIEngineContrib/lib/Foswiki/Engine/FastCGI/ProcManager.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FastCGI Runtime Engine Component of Foswiki - The Free and Open Source Wiki,
# http://foswiki.org/
#
# Copyright (C) 2008-2015 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
# Copyright (C) 2008-2017 Gilmar Santos Jr, jgasjr@gmail.com and Foswiki
# contributors. Foswiki contributors are listed in the AUTHORS file in the root
# of Foswiki distribution.
#
Expand Down Expand Up @@ -43,29 +43,27 @@ sub sig_manager {
}

sub pm_die {
my ($this, $msg, $n) = @_;
my ( $this, $msg, $n ) = @_;

$msg ||= ''; # protect against error in FCGI.pm
$msg ||= ''; # protect against error in FCGI.pm

if ($Foswiki::Engine::FastCGI::hupRecieved) {
Foswiki::Engine::FastCGI::reExec();
}
else {
$this->SUPER::pm_die($msg, $n);
$this->SUPER::pm_die( $msg, $n );
}
}

sub pm_notify {
my ($this, $msg) = @_;
my ( $this, $msg ) = @_;

return if $this->{quiet};
return if $this->{quiet};
$this->SUPER::pm_notify($msg);
}

sub pm_change_process_name {
my ($this,$name) = @_;

$name =~ s/perl/foswiki/g;
my ( $this, $name ) = @_;
$0 = $name;
}

Expand Down
1 change: 1 addition & 0 deletions FastCGIEngineContrib/tools/foswiki.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ FOSWIKI_CHILDREN=3
FOSWIKI_MAX_REQUESTS=-1
FOSWIKI_MAX_SIZE=200000
FOSWIKI_CHECK_SIZE=10
FOSWIKI_PNAME=foswiki
# The followng variables are NOT used by the systemd/foswiki.service file.
FOSWIKI_QUIET=true
#FOSWIKI_PIDFILE=/var/run/foswiki.pid
3 changes: 2 additions & 1 deletion FastCGIEngineContrib/tools/foswiki.init-script
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ FOSWIKI_MAX_REQUESTS=-1
FOSWIKI_MAX_SIZE=250000
FOSWIKI_CHECK_SIZE=10
FOSWIKI_QUIET=true
FOSWIKI_PNAME=foswiki

FOSWIKI_PIDFILE=/var/run/$NAME.pid

Expand All @@ -44,7 +45,7 @@ if [ -f /etc/default/$NAME ] ; then
fi

FOSWIKI_DAEMON=$FOSWIKI_ROOT/bin/$FOSWIKI_FCGI
FOSWIKI_DAEMON_OPTS="-n $FOSWIKI_CHILDREN -l $FOSWIKI_BIND -p $FOSWIKI_PIDFILE -d -c $FOSWIKI_CHECK_SIZE -x $FOSWIKI_MAX_REQUESTS -s $FOSWIKI_MAX_SIZE"
FOSWIKI_DAEMON_OPTS="-n $FOSWIKI_CHILDREN -l $FOSWIKI_BIND -p $FOSWIKI_PIDFILE -d -c $FOSWIKI_CHECK_SIZE -x $FOSWIKI_MAX_REQUESTS -s $FOSWIKI_MAX_SIZE -a $FOSWIKI_PNAME"

if $FOSWIKI_QUIET; then
FOSWIKI_DAEMON_OPTS="$FOSWIKI_DAEMON_OPTS -q"
Expand Down
2 changes: 2 additions & 0 deletions FastCGIEngineContrib/tools/systemd/foswiki.service
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Environment=FOSWIKI_CHILDREN=3
Environment=FOSWIKI_MAX_REQUESTS=-1
Environment=FOSWIKI_MAX_SIZE=250000
Environment=FOSWIKI_CHECK_SIZE=10
Environment=FOSWIKI_PNAME=foswiki

# Optional, overrides settings above
EnvironmentFile=-/etc/default/foswiki
Expand Down Expand Up @@ -46,6 +47,7 @@ ExecStart=/usr/bin/perl ${FOSWIKI_ROOT}/bin/${FOSWIKI_FCGI} \
-x $FOSWIKI_MAX_REQUESTS \
-s $FOSWIKI_MAX_SIZE \
-p ${FOSWIKI_ROOT}/working/foswiki.pid \
-a $FOSWIKI_PNAME \
-d

Type=forking
Expand Down
1 change: 0 additions & 1 deletion JsonRpcContrib/lib/Foswiki/Contrib/JsonRpcContrib/build.pl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env perl
use strict;
use warnings;

BEGIN { unshift @INC, split( /:/, $ENV{FOSWIKI_LIBS} ); }
use Foswiki::Contrib::Build;

Expand Down

0 comments on commit 121f6e3

Please sign in to comment.