View | Details | Raw Unified | Return to bug 7844
Collapse All | Expand All

(-)a/misc/plack/cpanm-install.sh (+8 lines)
Line 0 Link Here
1
#!/bin/sh -xe
2
3
sudo cpan App::cpanminus
4
cpanm --sudo Task::Plack \
5
	Plack::Middleware::Static::Minifier \
6
	Plack::Middleware::Debug::Profiler::NYTProf \
7
	Plack::Middleware::Debug::DBIProfile
8
(-)a/misc/plack/intranet-plack.sh (+17 lines)
Line 0 Link Here
1
#!/bin/sh -xe
2
3
site=ffzg
4
test ! -z "$1" && site=$1
5
dir=`dirname $0`
6
7
export KOHA_CONF=/etc/koha/sites/$site/koha-conf.xml 
8
export INTRANETDIR="$( xmlstarlet sel -t -v 'yazgfs/config/intranetdir' $KOHA_CONF )"
9
10
if [ ! -e "$INTRANETDIR/C4" ] ; then
11
	echo "intranetdir in $KOHA_CONF doesn't point to Koha git checkout"
12
	exit 1
13
fi
14
15
# we are not wathcing all CGI scripts since that tends to use a lot of CPU time for plackup
16
opt="--reload -R $INTRANETDIR/C4"
17
sudo -E -u $site-koha plackup -I $INTRANETDIR $opt --port 5001 $dir/koha.psgi
(-)a/misc/plack/koha.psgi (+45 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
use Plack::Builder;
3
use Plack::App::CGIBin;
4
use Plack::Middleware::Debug;
5
use Plack::App::Directory;
6
7
use C4::Context;
8
use C4::Languages;
9
use C4::Members;
10
use C4::Dates;
11
use C4::Boolean;
12
use C4::Letters;
13
use C4::Koha;
14
use C4::XSLT;
15
use C4::Branch;
16
use C4::Category;
17
18
my $app=Plack::App::CGIBin->new(root => $ENV{INTRANETDIR} || $ENV{OPACDIR});
19
20
builder {
21
22
	enable_if { $ENV{PLACK_DEBUG} } 'Debug',  panels => [
23
		qw(Environment Response Timer Memory),
24
#		[ 'Profiler::NYTProf', exclude => [qw(.*\.css .*\.png .*\.ico .*\.js .*\.gif)] ],
25
#		[ 'DBITrace', level => 1 ], # a LOT of fine-graded SQL trace
26
		[ 'DBIProfile', profile => 2 ],
27
	];
28
29
	enable_if { $ENV{PLACK_DEBUG} } 'StackTrace';
30
31
	enable_if { $ENV{INTRANETDIR} } "Plack::Middleware::Static",
32
		path => qr{^/intranet-tmpl/}, root => '/srv/koha/koha-tmpl/';
33
34
	enable_if { $ENV{OPACDIR} } "Plack::Middleware::Static",
35
		path => qr{^/opac-tmpl/}, root => '/srv/koha/koha-tmpl/';
36
37
	enable_if { $ENV{PLACK_MINIFIER} } "Plack::Middleware::Static::Minifier",
38
		path => qr{^/(intranet|opac)-tmpl/},
39
		root => './koha-tmpl/';
40
41
42
	mount "/cgi-bin/koha" => $app;
43
44
};
45
(-)a/misc/plack/opac-plack.sh (-1 / +17 lines)
Line 0 Link Here
0
- 
1
#!/bin/sh -xe
2
3
# --max-requests decreased from 1000 to 50 to keep memory usage sane
4
# --workers 8 which is number of cores on machine
5
6
site=ffzg
7
test ! -z "$1" && site=$1 && shift
8
dir=`dirname $0`
9
10
export KOHA_CONF=/etc/koha/sites/$site/koha-conf.xml 
11
export OPACDIR="$( xmlstarlet sel -t -v 'yazgfs/config/opacdir' $KOHA_CONF | sed 's,/cgi-bin/opac,,' )"
12
export LOGDIR="$( xmlstarlet sel -t -v 'yazgfs/config/logdir' $KOHA_CONF )"
13
14
# uncomment to enable logging
15
#opt="$opt --access-log $LOGDIR/opac-access.log --error-log $LOGDIR/opac-error.log"
16
#opt="$opt --server Starman -M FindBin --max-requests 50 --workers 4 -E deployment"
17
sudo -E -u $site-koha plackup -I $OPACDIR/.. $opt $* $dir/koha.psgi

Return to bug 7844