From 4ad6f99214f90019f10cf6a2a6c430d9ed339a76 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 10 Feb 2017 10:33:57 +0100 Subject: [PATCH] Bug 16749: Adjustments for koha-plack Content-Type: text/plain; charset=utf-8 [1] Use run_safe_xmlstarlet for plack workers and requests [2] Simplify adjust_paths. The lazy export statement is actually enough to replace adjust_paths by one direct call to adjust_paths_dev_install. Test plan: [1] See patch for adjusting xmlstarlet calls. [2] Change plack_requests to 51 in your koha-conf. Restart Plack and check that you see 51 in ps aux|grep plack. Signed-off-by: Marcel de Rooy --- debian/scripts/koha-plack | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack index 245d4a5..792a11d 100755 --- a/debian/scripts/koha-plack +++ b/debian/scripts/koha-plack @@ -74,16 +74,8 @@ start_plack() _check_and_fix_perms $instancename - PLACK_MAX_REQUESTS="50" - PLACK_WORKERS="2" - - if [[ $(get_plack_max_requests $instancename) ]]; then - PLACK_MAX_REQUESTS="$(get_plack_max_requests $instancename)" - fi - - if [[ $(get_plack_workers $instancename) ]]; then - PLACK_WORKERS="$(get_plack_workers $instancename)" - fi + PLACK_MAX_REQUESTS=$(run_safe_xmlstarlet $instancename plack_max_requests) || PLACK_MAX_REQUESTS="50" + PLACK_WORKERS=$(run_safe_xmlstarlet $instancename plack_workers) || PLACK_WORKERS="2" STARMANOPTS="-M FindBin --max-requests ${PLACK_MAX_REQUESTS} --workers ${PLACK_WORKERS} \ --user=${instancename}-koha --group ${instancename}-koha \ @@ -242,30 +234,6 @@ set_action() fi } -adjust_paths() -{ - # Optionally use alternative paths for a dev install - adjust_paths_dev_install $1 - - # PERL5LIB has been read from etc/default, add lib/installer - # export some vars (for plack.psgi) - export KOHA_HOME - if [ "$DEV_INSTALL" = "" ]; then - export PERL5LIB=$PERL5LIB:$KOHA_HOME/lib/installer - else - export DEV_INSTALL - export PERL5LIB=$PERL5LIB:$KOHA_HOME/installer - fi -} - -get_plack_max_requests() { - xmlstarlet sel -t -v 'yazgfs/config/plack_max_requests' "/etc/koha/sites/$1/koha-conf.xml" -} - -get_plack_workers() { - xmlstarlet sel -t -v 'yazgfs/config/plack_workers' "/etc/koha/sites/$1/koha-conf.xml" -} - STARMAN=$(which starman) op="" quiet="no" @@ -311,7 +279,9 @@ if [ $# -gt 0 ]; then if is_instance $name; then - adjust_paths $name + adjust_paths_dev_install $name + export DEV_INSTALL KOHA_HOME PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer + case $op in "start") start_plack $name -- 2.1.4