Bugzilla – Attachment 72824 Details for
Bug 20393
Remove redundant 'koha.psgi' and 'plackup.sh' files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20393: Remove redundant 'koha.psgi' and 'plackup.sh' files
Bug-20393-Remove-redundant-kohapsgi-and-plackupsh-.patch (text/plain), 7.93 KB, created by
Mason James
on 2018-03-14 01:22:26 UTC
(
hide
)
Description:
Bug 20393: Remove redundant 'koha.psgi' and 'plackup.sh' files
Filename:
MIME Type:
Creator:
Mason James
Created:
2018-03-14 01:22:26 UTC
Size:
7.93 KB
patch
obsolete
>From 49f4dd0a5bf18c4d5c7d3e50151ecb4746835e14 Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Wed, 14 Mar 2018 14:12:12 +1300 >Subject: [PATCH] Bug 20393: Remove redundant 'koha.psgi' and 'plackup.sh' > files >Content-Type: text/plain; charset="utf-8" > >--- > misc/plack/README.plack | 42 ------------------ > misc/plack/koha.psgi | 113 ------------------------------------------------ > misc/plack/plackup.sh | 54 ----------------------- > 3 files changed, 209 deletions(-) > delete mode 100644 misc/plack/README.plack > delete mode 100644 misc/plack/koha.psgi > delete mode 100755 misc/plack/plackup.sh > >diff --git a/misc/plack/README.plack b/misc/plack/README.plack >deleted file mode 100644 >index e1ed38b..0000000 >--- a/misc/plack/README.plack >+++ /dev/null >@@ -1,42 +0,0 @@ >-Bug 7844 - plack intranet tooling for developers >- >-koha.psgi example and plackup.sh script to run any Koha site >-intranet or opac interface under plack with optional multi-process >-Starman server >- >- plackup.sh site-name [intranet] >- >-site-name is used to find config /etc/koha/sites/site-name/koha-conf.xml >- >-All configuration is specified in koha.psgi, which you are welcomed to edit >-and tune according to your development needs (enable memcache, enable/disable >-debugging modules for plack and so on). >- >-For deployment of opac or intranet you would probably want to take a look >-in plackup.sh and enable starman as web server (which is pre-forking server >-written in perl) and put some web server in front of it to serve static web >-files (e.g. ngnix, apache) >- >-When you are happy with it, rename koha.psgi and plackup.sh it to site name >-and save it for safe-keeping. >- >-This commit message is included in patch as README.plack because it includes >-useful information for people using plack for first time. >- >-Test scenario: >-1. install plack and dependencies, as documented at >- http://wiki.koha-community.org/wiki/Plack >- >-2. start ./plackup.sh sitename i[ntranet] >- >-3. open intranet page http://localhost:5001/ and verify that it redirects >- to http://localhost:5001/cgi-bin/koha/mainpage.pl >- >-4. start ./plackup.sh sitename >- >-5. open OPAC http://localhost:5000/ and verify that it redirects to >- http://localhost:5000/cgi-bin/koha/opac-main.pl >- >-6. next step is to take a look into koha.psgi and enable additional >- debug modules, save file and reload page (plackup will reload >- code automatically) >diff --git a/misc/plack/koha.psgi b/misc/plack/koha.psgi >deleted file mode 100644 >index 8f87dfb..0000000 >--- a/misc/plack/koha.psgi >+++ /dev/null >@@ -1,113 +0,0 @@ >-#!/usr/bin/perl >-use Plack::Builder; >-use Plack::App::CGIBin; >-use lib qw( ./lib ); >-use Plack::Middleware::Debug; >-use Plack::App::Directory; >- >-#BZ 16357, add timestamps to warnings >-use Log::Log4perl qw(:easy); >-Log::Log4perl->easy_init({ level => $WARN, utf8 => 1 }); >-my $logger = Log::Log4perl->get_logger(); # use the default logger style >-$SIG{__WARN__} = sub { >- my $message = shift; >- $logger->warn($message); >-}; >- >-use CGI qw(-utf8 ); # we will lose -utf8 under plack >-{ >- no warnings 'redefine'; >- my $old_new = \&CGI::new; >- *CGI::new = sub { >- my $q = $old_new->( @_ ); >- $CGI::PARAM_UTF8 = 1; >- Koha::Caches->flush_L1_caches(); >- Koha::Cache::Memory::Lite->flush(); >- return $q; >- }; >-} >- >-BEGIN { >- >-# override configuration from startup script below: >-# (requires --reload option) >- >-$ENV{PLACK_DEBUG} = 1; # toggle debugging >- >-# memcache change requires restart >-$ENV{MEMCACHED_SERVERS} = "localhost:11211"; >-#$ENV{MEMCACHED_DEBUG} = 0; >- >-$ENV{PROFILE_PER_PAGE} = 1; # reset persistent and profile counters after each page, like CGI >-#$ENV{INTRANET} = 1; # usually passed from script >- >-#$ENV{DBI_AUTOPROXY}='dbi:Gofer:transport=null;cache=DBI::Util::CacheMemory' >- >-} # BEGIN >- >-use C4::Context; >-use C4::Languages; >-use C4::Members; >-use C4::Boolean; >-use C4::Letters; >-use C4::Koha; >-use C4::XSLT; >-use Koha::DateUtils; >-use Koha::Caches; >-use Koha::Cache::Memory::Lite; >-use Koha::Patron::Categories; >- >-=for preload >-use C4::Tags; # FIXME >-=cut >- >-use Devel::Size 0.77; # 0.71 doesn't work for Koha >-my $watch_capture_regex = '(C4|Koha)'; >- >-sub watch_for_size { >- my @watch = >- map { s/^.*$watch_capture_regex/$1/; s/\//::/g; s/\.pm$//; $_ } # fix paths >- grep { /$watch_capture_regex/ } >- keys %INC >- ; >- warn "# watch_for_size ",join(' ',@watch); >- return @watch; >-}; >- >-my $CGI_ROOT = $ENV{INTRANET} ? $ENV{INTRANETDIR} : $ENV{OPACDIR}; >-warn "# using Koha ", $ENV{INTRANET} ? 'intranet' : 'OPAC', " CGI from $CGI_ROOT\n"; >-my $app=Plack::App::CGIBin->new(root => $CGI_ROOT)->to_app; >-my $home = sub { >- return [ 302, [ Location => '/cgi-bin/koha/' . ( $ENV{INTRANET} ? 'mainpage.pl' : 'opac-main.pl' ) ] ]; >-}; >- >-builder { >- >- # please don't use plugins which are under enable_if $ENV{PLACK_DEBUG} in production! >- # they are known to leek memory >- enable_if { $ENV{PLACK_DEBUG} } 'Debug', panels => [ >- qw(Environment Response Timer Memory), >- # optional plugins (uncomment to enable) are sorted according to performance implact >-# [ 'Devel::Size', for => \&watch_for_size ], # https://github.com/dpavlin/p5-plack-devel-debug-devel-size >-# [ 'DBIProfile', profile => 2 ], >-# [ 'DBITrace', level => 1 ], # a LOT of fine-graded SQL trace >-# [ 'Profiler::NYTProf', exclude => [qw(.*\.css .*\.png .*\.ico .*\.js .*\.gif)] ], >- ]; >- >- # don't enable this plugin in production, since stack traces reveal too much information >- # about system to potential attackers! >- enable_if { $ENV{PLACK_DEBUG} } 'StackTrace'; >- >- # this enables plackup or starman to serve static files and provide working plack >- # setup without need for front-end web server to serve static files >- enable_if { $ENV{INTRANETDIR} } "Plack::Middleware::Static", >- path => qr{^/(intranet|opac)-tmpl/}, >- root => "$ENV{INTRANETDIR}/koha-tmpl/"; >- >- # + is required so Plack doesn't try to prefix Plack::Middleware:: >- enable "+Koha::Middleware::SetEnv"; >- >- mount "/cgi-bin/koha" => $app; >- mount "/" => $home; >- >-}; >diff --git a/misc/plack/plackup.sh b/misc/plack/plackup.sh >deleted file mode 100755 >index 2c7f599..0000000 >--- a/misc/plack/plackup.sh >+++ /dev/null >@@ -1,54 +0,0 @@ >-#!/bin/sh -e >- >-# This is plack startup script for Koha >- >-# ./plackup.sh [site] [intranet] >- >-site=$1 >-test ! -z "$site" && shift || ( echo "usage: $0 [site] [i[tranet]]" ; exit 1 ) >- >-# extract useful paths from koha-conf.xml >-export KOHA_CONF=/etc/koha/sites/$site/koha-conf.xml >-export LOGDIR="$( sudo -u $site-koha xmlstarlet sel -t -v 'yazgfs/config/logdir' $KOHA_CONF )" >-export INTRANETDIR="$( sudo -u $site-koha xmlstarlet sel -t -v 'yazgfs/config/intranetdir' $KOHA_CONF )" >-export OPACDIR="$( sudo -u $site-koha xmlstarlet sel -t -v 'yazgfs/config/opacdir' $KOHA_CONF | sed 's,/cgi-bin/opac,,' )" >- >-dir=`dirname $0` >- >-# enable memcache - it's safe even on installation which don't have it >-# since Koha has check on C4::Context >-#export MEMCACHED_SERVERS=localhost:11211 >-# pass site name as namespace to perl code >-export MEMCACHED_NAMESPACE=$site >-#export MEMCACHED_DEBUG=1 >- >-if [ ! -e "$INTRANETDIR/C4" ] ; then >- echo "intranetdir in $KOHA_CONF doesn't point to Koha git checkout" >- exit 1 >-fi >- >-if [ -z "$1" ] ; then # type anything after site name for intranet! >- INTRANET=0 >- PORT=5000 >-else >- INTRANET=1 >- PORT=5001 >- shift # pass rest of arguments to plackup >-fi >-export INTRANET # pass to plack >- >-# uncomment to enable logging >-#opt="$opt --access-log $LOGDIR/opac-access.log --error-log $LOGDIR/opac-error.log" >- >-# --max-requests 50 decreased from 1000 to keep memory usage sane >-# --workers 4 number of cores on machine >-#test "$INTRANET" != 1 && \ # don't use Starman for intranet >-opt="$opt --server Starman -M FindBin --max-requests 50 --workers 4" >- >-# -E deployment turn off access log on STDOUT >-opt="$opt -E deployment" >- >-# comment out reload in production! >-opt="$opt --reload -R $INTRANETDIR/C4 -R $INTRANETDIR/Koha" >- >-sudo -E -u $site-koha plackup --port $PORT -I $INTRANETDIR -I $INTRANETDIR/installer $opt $* $dir/koha.psgi >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20393
:
72823
|
72824
|
73392
|
75895
|
75896