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

(-)a/C4/Installer/PerlDependencies.pm (-10 lines)
Lines 284-294 our $PERL_DEPS = { Link Here
284
        'required' => '1',
284
        'required' => '1',
285
        'min_ver'  => '3.15'
285
        'min_ver'  => '3.15'
286
    },
286
    },
287
    'Starman' => {
288
	'usage' => 'preforking PSGI/PLACK web server',
289
	'required' => '0',
290
	'min_ver' => '0.300'
291
     },
292
    'CGI::Emulate::PSGI' => {
287
    'CGI::Emulate::PSGI' => {
293
	'usage' => 'PLACK',
288
	'usage' => 'PLACK',
294
	'required' => '0',
289
	'required' => '0',
Lines 299-309 our $PERL_DEPS = { Link Here
299
	'required' => '0',
294
	'required' => '0',
300
	'min_ver' => '0.15'
295
	'min_ver' => '0.15'
301
    },
296
    },
302
    'Plack::Middleware::Debug' => {
303
	'usage' => 'PLACK Debugging',
304
	'required' => '0',
305
	'min_ver' => '0.1'
306
    },
307
    'Class::Factory::Util' => {
297
    'Class::Factory::Util' => {
308
        'usage'    => 'Core',
298
        'usage'    => 'Core',
309
        'required' => '1',
299
        'required' => '1',
(-)a/Makefile.PL (-1 / +14 lines)
Lines 196-201 Directory for Zebra's data files. Link Here
196
196
197
Directory for Zebra's UNIX-domain sockets.
197
Directory for Zebra's UNIX-domain sockets.
198
198
199
=item PLACK_LOCK_DIR
200
201
Directory for Plack's lock files.
202
203
=item PLACK_RUN_DIR
204
205
Directory for Plack's UNIX-domain sockets.
206
199
=item MISC_DIR
207
=item MISC_DIR
200
208
201
Directory for for miscellaenous scripts, among other
209
Directory for for miscellaenous scripts, among other
Lines 306-312 my $target_map = { Link Here
306
  './skel'                      => 'NONE',
314
  './skel'                      => 'NONE',
307
  './skel/var/log/koha'         => { target => 'LOG_DIR', trimdir => -1 },
315
  './skel/var/log/koha'         => { target => 'LOG_DIR', trimdir => -1 },
308
  './skel/var/spool/koha'       => { target => 'BACKUP_DIR', trimdir => -1 },
316
  './skel/var/spool/koha'       => { target => 'BACKUP_DIR', trimdir => -1 },
309
  './skel/var/run/koha/plack' => { target => 'PLACK_RUN_DIR', trimdir => -1 },
317
  './skel/var/run/koha/plack'   => { target => 'PLACK_RUN_DIR', trimdir => -1 },
318
  './skel/var/lock/koha/plack'  => { target => 'PLACK_LOCK_DIR', trimdir => 6 },
310
  './skel/var/run/koha/zebradb' => { target => 'ZEBRA_RUN_DIR', trimdir => -1 },
319
  './skel/var/run/koha/zebradb' => { target => 'ZEBRA_RUN_DIR', trimdir => -1 },
311
  './skel/var/lock/koha/zebradb/authorities' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
320
  './skel/var/lock/koha/zebradb/authorities' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
312
  './skel/var/lib/koha/zebradb/authorities/key'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
321
  './skel/var/lib/koha/zebradb/authorities/key'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
Lines 591-596 my %test_suite_override_dirs = ( Link Here
591
    ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
600
    ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
592
    ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
601
    ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
593
    ZEBRA_RUN_DIR  => ['var', 'run', 'zebradb'],
602
    ZEBRA_RUN_DIR  => ['var', 'run', 'zebradb'],
603
    PLACK_LOCK_DIR => ['var', 'lock', 'plack'],
594
    PLACK_RUN_DIR  => ['var', 'run', 'plack'],
604
    PLACK_RUN_DIR  => ['var', 'run', 'plack'],
595
);
605
);
596
606
Lines 1298-1303 sub get_target_directories { Link Here
1298
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
1308
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
1299
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1309
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1300
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1310
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1311
        $dirmap{'PLACK_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'plack');
1301
        $dirmap{'PLACK_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'plack');
1312
        $dirmap{'PLACK_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'plack');
1302
    } elsif ($mode eq 'dev') {
1313
    } elsif ($mode eq 'dev') {
1303
        my $curdir = File::Spec->rel2abs(File::Spec->curdir());
1314
        my $curdir = File::Spec->rel2abs(File::Spec->curdir());
Lines 1329-1334 sub get_target_directories { Link Here
1329
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1340
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1330
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins');
1341
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins');
1331
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1342
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1343
        $dirmap{'PLACK_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'plack');
1332
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1344
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1333
        $dirmap{'PLACK_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'plack');
1345
        $dirmap{'PLACK_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'plack');
1334
    } else {
1346
    } else {
Lines 1354-1359 sub get_target_directories { Link Here
1354
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins');
1366
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins');
1355
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
1367
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
1356
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
1368
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
1369
        $dirmap{'PLACK_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'plack');
1357
        $dirmap{'PLACK_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'plack');
1370
        $dirmap{'PLACK_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'plack');
1358
    }
1371
    }
1359
1372
(-)a/etc/koha-nginx.conf (+5 lines)
Lines 1-3 Link Here
1
#USE THIS AT YOUR OWN RISK#
2
#DEVELOPMENT ONLY#
3
#NOT RECOMMENDED FOR PRODUCTION#
4
#02/06/2013
5
1
upstream backendurl {
6
upstream backendurl {
2
      server unix:__PLACK_RUN_DIR__/plack.sock;
7
      server unix:__PLACK_RUN_DIR__/plack.sock;
3
}
8
}
(-)a/misc/bin/koha-plack.sh (-44 / +104 lines)
Lines 1-4 Link Here
1
#!/bin/sh -e
1
#!/bin/bash
2
2
3
# This file is part of Koha.
3
# This file is part of Koha.
4
#
4
#
Lines 15-73 Link Here
15
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
15
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16
# Suite 330, Boston, MA  02111-1307 USA
16
# Suite 330, Boston, MA  02111-1307 USA
17
17
18
### BEGIN INIT INFO# Provides:          koha-plack
18
### BEGIN INIT INFO
19
# Provides:          koha-plack-daemon
19
# Required-Start:    $syslog $remote_fs
20
# Required-Start:    $syslog $remote_fs
20
# Required-Stop:     $syslog $remote_fs# Default-Start:     2 3 4 5
21
# Required-Stop:     $syslog $remote_fs
21
# Default-Stop:      0 1 6# Short-Description: Plack server for Koha
22
# Default-Start:     2 3 4 5
23
# Default-Stop:      0 1 6
24
# Short-Description: Plack server daemon for Koha
22
### END INIT INFO
25
### END INIT INFO
23
26
24
export KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
27
export KOHA_CONF=__KOHA_CONF_DIR__/koha-conf.xml
25
#export OPACDIR=__OPAC_WWW_DIR__
28
NAME=KOHA
26
#export INTRANETDIR=__OPAC_WWW_DIR__
29
LOGDIR=__LOG_DIR__
27
export LOGDIR=__LOG_DIR__
30
USER=www-data
28
USER=__KOHA_USER__
31
GROUP=www-data
29
GROUP=__KOHA_GROUP__
30
RUNDIR=__PLACK_RUN_DIR__
32
RUNDIR=__PLACK_RUN_DIR__
31
PIDFILE=$RUNDIR/plack.pid
33
LOCKDIR=__PLACK_LOCK_DIR__
34
PIDFILE=$LOCKDIR/plack.pid
35
APP_PSGI=__SCRIPT_DIR__/koha.psgi
36
FCGI_LISTEN=$RUNDIR/plack.sock
37
#FCGI_LISTEN=127.0.0.1:5000
38
OPTIONS="--listen $FCGI_LISTEN --access-log $LOGDIR/koha-access.log --error-log $LOGDIR/koha-error.log -M FindBin --max-requests 50 -E deployment $APP_PSGI"
39
DAEMON=$(which starman)
40
 if [ ! -x "$DAEMON" ] ; then
41
     OPTIONS="-s FCGI --listen $FCGI_LISTEN -E production --app $APP_PSGI --access-log $LOGDIR/koha-access.log --error-log $LOGDIR/koha-error.log"
42
     DAEMON=$(which plackup)
43
 fi
32
44
33
# Use one of these lines to choose between TCP port and UNIX socket listeners
45
[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions
34
SOCKET=$RUNDIR/plack.sock
35
#PORT=5000
36
46
37
case "$1" in
47
start()
38
    start)
48
{
39
	echo "Starting Koha Plack Daemon"
49
    log_daemon_msg "Starting plack server" "$NAME"
50
    start-stop-daemon -b -m --start --quiet --pidfile "$PIDFILE" --exec $DAEMON -- $OPTIONS
51
    sleep 3
52
    chown -R $USER:$GROUP $FCGI_LISTEN
53
    chown -R $USER:$GROUP $LOCKDIR
54
    if [ $? != 0 ]; then
55
        log_end_msg 1
56
        exit 1
57
    else
58
        log_end_msg 0
59
    fi
60
}
40
61
41
      # create run and lock directories if needed;
62
signal()
42
      # /var/run and /var/lock are completely cleared at boot
63
{
43
      # on some platforms
44
      if [ ! -d $RUNDIR ]; then
45
        umask 022
46
        mkdir -p $RUNDIR
47
        if [ $EUID -eq 0 ]; then
48
            chown $USER:$GROUP $RUNDIR
49
        fi
50
      fi
51
64
52
        opt="$opt --access-log $LOGDIR/koha-access.log --error-log $LOGDIR/koha-error.log"
65
    if [ "$1" = "stop" ]; then
53
        opt="$opt -M FindBin --max-requests 50 --workers 2 -E deployment"
66
    SIGNAL="TERM"
54
        if [ $SOCKET ]; then
67
        log_daemon_msg "Stopping plack server" "$NAME"
55
            opt="$opt --listen $SOCKET -D --pid $PIDFILE"
68
    else
56
        elif [ $PORT ]; then
69
    if [ "$1" = "reload" ]; then
57
            opt="$opt --port $PORT -D --pid $PIDFILE"
70
        SIGNAL="HUP"
71
            log_daemon_msg "Reloading plack server" "$NAME"
72
    else
73
        echo "ERR: wrong parameter given to signal()"
74
        exit 1
75
    fi
76
    fi
77
    if [ -f "$PIDFILE" ]; then
78
        start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
79
     if [ $? = 0 ]; then
80
            log_end_msg 0
81
        else
82
        SIGNAL="KILL"
83
        start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
84
            if [ $? != 0 ]; then
85
                log_end_msg 1
86
                [ $2 != 0 ] || exit 0
87
            else
88
            rm "$PIDFILE"
89
                log_end_msg 0
90
            fi
58
        fi
91
        fi
59
        starman $opt __SCRIPT_DIR__/koha.psgi
92
    if [ "$SIGNAL" = "KILL" ]; then
60
93
        rm -f "$PIDFILE"
61
        if [ $SOCKET ]; then
62
            chown $USER:$GROUP $SOCKET
63
	    chmod 660 $SOCKET
64
        fi
94
        fi
65
        ;;
95
    else
96
        log_end_msg 0
97
    fi
98
}
99
100
case "$1" in
101
    start)
102
    start
103
    ;;
104
105
    force-start)
106
    start
107
    ;;
108
66
    stop)
109
    stop)
67
        start-stop-daemon --stop --pidfile $PIDFILE
110
        signal stop 0
68
        ;;
111
    ;;
112
113
    force-stop)
114
    signal stop 0
115
    ;;
116
117
    reload)
118
    signal reload 0
119
    ;;
120
121
    force-reload|restart)
122
    signal stop 1
123
    sleep 2
124
    start
125
    ;;
126
69
    *)
127
    *)
70
        echo "Usage: koha-plack {start|stop}"
128
    echo "Usage: /etc/init.d/$NAME {start|force-start|stop|force-stop|reload|restart|force-reload}"
71
        exit 1
129
    exit 1
72
        ;;
130
    ;;
73
esac
131
esac
132
133
exit 0
(-)a/misc/bin/koha.psgi (-3 / +10 lines)
Lines 10-16 use lib("__PERL_MODULE_DIR__/installer"); Link Here
10
use Plack::Builder;
10
use Plack::Builder;
11
use Plack::App::CGIBin;
11
use Plack::App::CGIBin;
12
use Plack::App::Directory;
12
use Plack::App::Directory;
13
use Plack::Middleware::Debug;
14
use Plack::App::URLMap;
13
use Plack::App::URLMap;
15
use C4::Context;
14
use C4::Context;
16
use C4::Languages;
15
use C4::Languages;
Lines 22-37 use C4::Koha; Link Here
22
use C4::XSLT;
21
use C4::XSLT;
23
use C4::Branch;
22
use C4::Branch;
24
use C4::Category;
23
use C4::Category;
24
use Module::Load::Conditional qw[can_load check_install requires];
25
26
my $use_list = {
27
28
};
29
30
if(can_load( modules => { Plack::Middleware::Debug => undef} ) && $ENV{KOHA_DEBUG}){
31
    my $panels = Plack::Middleware::Debug->default_panels;
32
}
25
33
26
C4::Context->disable_syspref_cache();
34
C4::Context->disable_syspref_cache();
27
35
28
my $intra=Plack::App::CGIBin->new(root => "__INTRANET_CGI_DIR__" );
36
my $intra=Plack::App::CGIBin->new(root => "__INTRANET_CGI_DIR__" );
29
37
30
my $opac = Plack::App::CGIBin->new(root => "__OPAC_CGI_DIR__");
38
my $opac = Plack::App::CGIBin->new(root => "__OPAC_CGI_DIR__");
31
my $panels = Plack::Middleware::Debug->default_panels;
32
builder {
39
builder {
33
    enable_if{
40
    enable_if{
34
	$ENV{DEBUG}
41
	$ENV{KOHA_DEBUG}
35
    } 'Debug',  panels => [[ 'DBITrace', level => 1 ], @$panels ];
42
    } 'Debug',  panels => [[ 'DBITrace', level => 1 ], @$panels ];
36
43
37
    enable "Plack::Middleware::Static";
44
    enable "Plack::Middleware::Static";
(-)a/rewrite-config.PL (+1 lines)
Lines 125-130 $prefix = $ENV{'INSTALL_BASE'} || "/usr"; Link Here
125
  '__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",
125
  '__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",
126
  '__ZEBRA_DATA_DIR__' => "$prefix/var/lib/zebradb",
126
  '__ZEBRA_DATA_DIR__' => "$prefix/var/lib/zebradb",
127
  '__ZEBRA_RUN_DIR__' => "$prefix/var/run/zebradb",
127
  '__ZEBRA_RUN_DIR__' => "$prefix/var/run/zebradb",
128
  '__PLACK_LOCK_DIR__' => "$prefix/var/lock/plack",
128
  '__PLACK_RUN_DIR__' => "$prefix/var/run/plack",
129
  '__PLACK_RUN_DIR__' => "$prefix/var/run/plack",
129
  '__ZEBRA_MARC_FORMAT__' => 'marc21',
130
  '__ZEBRA_MARC_FORMAT__' => 'marc21',
130
  '__ZEBRA_LANGUAGE__' => 'en',
131
  '__ZEBRA_LANGUAGE__' => 'en',
(-)a/skel/var/lock/koha/plack/README (+1 lines)
Line 0 Link Here
1
Plack lock dir
(-)a/skel/var/run/koha/plack/README (-1 / +1 lines)
Line 0 Link Here
0
- 
1
Plack Unix-domain sockets

Return to bug 9316