224eab822d
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 welcome 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) Signed-off-by: Magnus Enger <magnus@enger.priv.no> Works as advertised. As I have explained in a comment on the bug this looks like a very good starting point, and we can argue about the details and add more options over time. Very happy to sign this off! (My earlier concern about / not working has now been taken care of, thanks Dobrica!) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
54 lines
1.8 KiB
Bash
Executable file
54 lines
1.8 KiB
Bash
Executable file
#!/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
|