Offer plack as valid alternative for installation. For now, some progress is documented at wiki page: http://wiki.koha-community.org/wiki/Plack
Created attachment 41481 [details] [review] Bug 13791: Plack out-of-the-box support on packages This patch introduces a koha-plack script that controls running Plack processes for each instance. They are run using 'starman', listening on a Unix Domain Socket (UDS): /var/run/koha/<instancename>/plack.sock The plack configuration file[1] is expected to be on: /etc/koha/plack.psgi It also adds the following helper functions to koha-functions.sh: - is_plack_enabled - is_plack_running Done: - koha-plack script - suitable psgi file TODO (by priority): - changes to koha-create - configurable workers/max-reqs (per instance?) - allow per instance psgi file (debugging?) and fallback to shipped - tab completion in bash [1] Yeah, a single file. Because we will be relying on multiple mount points for each "app" (i.e. 'opac' and 'intranet', and 'api' ;-) )
Created attachment 41482 [details] [review] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration.
Created attachment 41483 [details] [review] Bug 13791: koha-plack documentation
Created attachment 41484 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results.
Created attachment 41485 [details] [review] Bug 13791: make koha-common init script aware of plack This patch makes the packages' koha-common script aware of plack. It does so by relying on koha-list --plack to know which instances have Plack configured, and uses the koha-plack script to manage the running daemons.
Created attachment 41486 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results.
Created attachment 41503 [details] [review] Bug 13791: Plack out-of-the-box support on packages This patch introduces a koha-plack script that controls running Plack processes for each instance. They are run using 'starman', listening on a Unix Domain Socket (UDS): /var/run/koha/<instancename>/plack.sock The plack configuration file[1] is expected to be on: /etc/koha/plack.psgi It also adds the following helper functions to koha-functions.sh: - is_plack_enabled - is_plack_running Done: - koha-plack script - suitable psgi file [1] Yeah, a single file. Because we will be relying on multiple mount points for each "app" (i.e. 'opac' and 'intranet', and 'api' ;-) )
Created attachment 41504 [details] [review] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration. A check for the right apache version is introduced, in the for of an IfVersion block: <IfVersion >= 2.4> --- Plack configuration here --- </IfVersion>
Created attachment 41505 [details] [review] Bug 13791: koha-plack documentation
Created attachment 41506 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results.
Created attachment 41507 [details] [review] Bug 13791: make koha-common init script aware of plack This patch makes the packages' koha-common script aware of plack. It does so by relying on koha-list --plack to know which instances have Plack configured, and uses the koha-plack script to manage the running daemons.
Created attachment 41508 [details] [review] Bug 13791: Plack out-of-the-box support on packages This patch introduces a koha-plack script that controls running Plack processes for each instance. They are run using 'starman', listening on a Unix Domain Socket (UDS): /var/run/koha/<instancename>/plack.sock The plack configuration file[1] is expected to be on: /etc/koha/plack.psgi and is installed by the package. It also adds the following helper functions to koha-functions.sh: - is_plack_enabled - is_plack_running Done: - koha-plack script - suitable psgi file [1] Yeah, a single file. Because we will be relying on multiple mount points for each "app" (i.e. 'opac' and 'intranet', and 'api' ;-) )
Created attachment 41509 [details] [review] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration. A check for the right apache version is introduced, in the for of an IfVersion block: <IfVersion >= 2.4> --- Plack configuration here --- </IfVersion>
Created attachment 41510 [details] [review] Bug 13791: koha-plack documentation
Created attachment 41511 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results.
Created attachment 41512 [details] [review] Bug 13791: make koha-common init script aware of plack This patch makes the packages' koha-common script aware of plack. It does so by relying on koha-list --plack to know which instances have Plack configured, and uses the koha-plack script to manage the running daemons. It also introduces a plack_status function to check the status of the Plack daemon when called: $ servive koha-common status Regards
Created attachment 41513 [details] [review] Bug 13791: tab-completion for koha-plack in bash This patch adds tab-completion in bash for the koha-plack command. After the --start, --stop, --restart and --disable switches it only offers plack-enabled instances. And disabled instances to --enable. --help and -h just finish end the completion. --quiet and -q are trickier to implement. They will work (be offered) only before the action switches.
Hello Tomás, I think there is a typo in apache configuration here: http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41509&action=diff#a/debian/templates/apache-site.conf.in_sec1 Start tag <IfVersion>, but end tag </IfDefine>
And I had to install starman and perl module Plack::Middleware::ReverseProxy shouldn't it be at least documented somewhere?
(In reply to Josef Moravec from comment #19) > And I had to install starman and perl module Plack::Middleware::ReverseProxy > > shouldn't it be at least documented somewhere? I'll fix both. Thanks Josef
Created attachment 41563 [details] [review] Bug 13791: Plack out-of-the-box support on packages This patch introduces a koha-plack script that controls running Plack processes for each instance. They are run using 'starman', listening on a Unix Domain Socket (UDS): /var/run/koha/<instancename>/plack.sock The plack configuration file[1] is expected to be on: /etc/koha/plack.psgi and is installed by the package. It also adds the following helper functions to koha-functions.sh: - is_plack_enabled - is_plack_running Done: - koha-plack script - suitable psgi file To test this patches you will need to install - starman - libplack-middleware-reverseproxy-perl [1] Yeah, a single file. Because we will be relying on multiple mount points for each "app" (i.e. 'opac' and 'intranet', and 'api' ;-) )
Created attachment 41564 [details] [review] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration. A check for the right apache version is introduced, in the for of an IfVersion block: <IfVersion >= 2.4> --- Plack configuration here --- </IfVersion>
Created attachment 41565 [details] [review] Bug 13791: koha-plack documentation
Created attachment 41566 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results.
Created attachment 41567 [details] [review] Bug 13791: make koha-common init script aware of plack This patch makes the packages' koha-common script aware of plack. It does so by relying on koha-list --plack to know which instances have Plack configured, and uses the koha-plack script to manage the running daemons. It also introduces a plack_status function to check the status of the Plack daemon when called: $ servive koha-common status Regards
Created attachment 41568 [details] [review] Bug 13791: tab-completion for koha-plack in bash This patch adds tab-completion in bash for the koha-plack command. After the --start, --stop, --restart and --disable switches it only offers plack-enabled instances. And disabled instances to --enable. --help and -h just finish end the completion. --quiet and -q are trickier to implement. They will work (be offered) only before the action switches.
Created attachment 41571 [details] [review] Bug 13791: Plack out-of-the-box support on packages This patch introduces a koha-plack script that controls running Plack processes for each instance. They are run using 'starman', listening on a Unix Domain Socket (UDS): /var/run/koha/<instancename>/plack.sock The plack configuration file[1] is expected to be on: /etc/koha/plack.psgi and is installed by the package. It also adds the following helper functions to koha-functions.sh: - is_plack_enabled - is_plack_running Done: - koha-plack script - suitable psgi file To test this patches you will need to install - starman - libplack-middleware-reverseproxy-perl [1] Yeah, a single file. Because we will be relying on multiple mount points for each "app" (i.e. 'opac' and 'intranet', and 'api' ;-) ) Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 41572 [details] [review] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration. A check for the right apache version is introduced, in the for of an IfVersion block: <IfVersion >= 2.4> --- Plack configuration here --- </IfVersion> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 41573 [details] [review] Bug 13791: koha-plack documentation Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 41574 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results. Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 41575 [details] [review] Bug 13791: make koha-common init script aware of plack This patch makes the packages' koha-common script aware of plack. It does so by relying on koha-list --plack to know which instances have Plack configured, and uses the koha-plack script to manage the running daemons. It also introduces a plack_status function to check the status of the Plack daemon when called: $ servive koha-common status Regards Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 41576 [details] [review] Bug 13791: tab-completion for koha-plack in bash This patch adds tab-completion in bash for the koha-plack command. After the --start, --stop, --restart and --disable switches it only offers plack-enabled instances. And disabled instances to --enable. --help and -h just finish end the completion. --quiet and -q are trickier to implement. They will work (be offered) only before the action switches. Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
root@koha-deb:/usr/sbin# koha-plack --disable library Plack disabled for library root@koha-deb:/usr/sbin# koha-plack --enable library Plack already enabled for library hum? Not sure I have tested correctly, back on this one tomorrow.
(In reply to Jonathan Druart from comment #33) > root@koha-deb:/usr/sbin# koha-plack --disable library > Plack disabled for library > root@koha-deb:/usr/sbin# koha-plack --enable library > Plack already enabled for library > > hum? > > Not sure I have tested correctly, back on this one tomorrow. Hi Jonathan! 1) It seems to me that the script is not catching the absense of the relevant line on your site's virtualhosts definition. This could be a bug in koha-functions.sh (is_plack_enabled). Probably not using the right koha-functions.sh (look at (4). 2) You should be looking at /var/log/koha/<instance>/plack-output.log to know if you are on plack. But you should notice, you know... it is slightly super faster. When you have plack enabled a line like this is uncommented in /etc/apache2/sites-enabled/<instance>.conf: OPAC: # Include /etc/koha/apache-shared-opac-plack.conf Intranet: # Include /etc/koha/apache-shared-intranet-plack.conf Those files need to be present in those dirs (look at (4) for details). 3) You need to know that koha-plack --enable <instance> is not starting the daemon for now, so you need to issue koha-plack --start <instance> to have it running. This is independent from the Apache conf hook, so Plack might be running but not being used. You can ps waux | grep starman (there should be a master process with two workers). 4) Where the files are put is really important because they are picked to generate a suitable apache configuration, otherwise it won't work.: debian/templates/apache-shared-*-plack.conf -> /etc/koha debian/templates/apache-site.conf.in -> /etc/koha debian/koha-common.bash-completion -> /etc/bash_completion.d/koha-common debian/scripts/koha-functions.sh -> /usr/share/koha/bin debian/scripts/koha-* -> /usr/sbin The template files need to be put in place BEFORE the instance is created. I think I'll build the packages for this so testing is pretty easier. Also note that you need to install - starman - libplack-middleware-reverseproxy-perl Thanks for your time testing this!
Thanks a lot for this additional information, it's very useful. I had to restart apache2 to take into account the change (I suppose it's intended). But... I got an error on the mainpage: ==> /var/log/koha/library-plack/plack-error.log <== Could not compile /usr/share/koha/intranet/cgi-bin/mainpage.pl: Attempt to reload C4/Auth.pm aborted. Compilation failed in require at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. BEGIN failed--compilation aborted at /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. I successfully access to / but got this error on /cgi-bin/koha/mainpage.pl Not caused by this patch. Marked as Passed QA, great job Tomás!
Created attachment 41748 [details] [review] Bug 13791: Plack out-of-the-box support on packages This patch introduces a koha-plack script that controls running Plack processes for each instance. They are run using 'starman', listening on a Unix Domain Socket (UDS): /var/run/koha/<instancename>/plack.sock The plack configuration file[1] is expected to be on: /etc/koha/plack.psgi and is installed by the package. It also adds the following helper functions to koha-functions.sh: - is_plack_enabled - is_plack_running Done: - koha-plack script - suitable psgi file To test this patches you will need to install - starman - libplack-middleware-reverseproxy-perl [1] Yeah, a single file. Because we will be relying on multiple mount points for each "app" (i.e. 'opac' and 'intranet', and 'api' ;-) ) Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 41749 [details] [review] Bug 13791: Apache configuration files This patch adds an include to each VirtualHost definition (OPAC and Intranet) and a variable definition, taking advantage of Apache 2.4.x features. The instance name is reused inside the includes providing a simple way of dealing with the apache <-> plack configuration. A check for the right apache version is introduced, in the for of an IfVersion block: <IfVersion >= 2.4> --- Plack configuration here --- </IfVersion> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 41750 [details] [review] Bug 13791: koha-plack documentation Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 41751 [details] [review] Bug 13791: make koha-list aware of plack This patch adds the --plack and --noplack option switches to koha-list for filtering instances to be listed. This is particularly important for init scripts and cronjobs. To test: - Play with koha-list --plack and koha-plack --enable/--disable and verify that koha-list returns the expected results. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 41752 [details] [review] Bug 13791: make koha-common init script aware of plack This patch makes the packages' koha-common script aware of plack. It does so by relying on koha-list --plack to know which instances have Plack configured, and uses the koha-plack script to manage the running daemons. It also introduces a plack_status function to check the status of the Plack daemon when called: $ servive koha-common status Regards Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 41753 [details] [review] Bug 13791: tab-completion for koha-plack in bash This patch adds tab-completion in bash for the koha-plack command. After the --start, --stop, --restart and --disable switches it only offers plack-enabled instances. And disabled instances to --enable. --help and -h just finish end the completion. --quiet and -q are trickier to implement. They will work (be offered) only before the action switches. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I would be really useful to have the ability to enable plack for the OPAC or staff side only (since the staff is not stable yet...)
(In reply to Jonathan Druart from comment #35) > Thanks a lot for this additional information, it's very useful. > > I had to restart apache2 to take into account the change (I suppose it's > intended). > But... I got an error on the mainpage: > > ==> /var/log/koha/library-plack/plack-error.log <== > Could not compile /usr/share/koha/intranet/cgi-bin/mainpage.pl: Attempt to > reload C4/Auth.pm aborted. > Compilation failed in require at > /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. > BEGIN failed--compilation aborted at > /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. > > I successfully access to / but got this error on /cgi-bin/koha/mainpage.pl > > Not caused by this patch. And actually all other pages
So, the install where I have tried this page is 3.2002000. I have tried with a git install, checkouted 3.20.02, and I don't get the error.
(In reply to Jonathan Druart from comment #43) Helo, I want to confirm same problem in staff side. Mike > Thanks a lot for this additional information, it's very useful. > > I had to restart apache2 to take into account the change (I suppose it's > intended). > But... I got an error on the mainpage: > > ==> /var/log/koha/library-plack/plack-error.log <== > Could not compile /usr/share/koha/intranet/cgi-bin/mainpage.pl: Attempt to > reload C4/Auth.pm aborted. > Compilation failed in require at > /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. > BEGIN failed--compilation aborted at > /usr/share/koha/intranet/cgi-bin/mainpage.pl line 25. > > I successfully access to / but got this error on /cgi-bin/koha/mainpage.pl > > Not caused by this patch. And actually all other pages
Created attachment 41866 [details] [review] Bug 13791: (QA followup) Plack support requires Apache 2.4.8+ The Apache 2.4 documentation says UDS support for ProxyPass has been introduced in Apache 2.4.7. That's what is shipped by Koha's supported Debian / Ubuntu versions. But it is not true, empiric tests and even the changelog for the apache project says the feature got introduced in 2.4.8. So to avoid breakages I raised the version number test on the apache files to 2.4.8. New bugs will be filled for dealing with this if we find it necessary. Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Patches pushed to master. Farewell, CGI.
Created attachment 42038 [details] [review] Bug 13791: (RM followup) Add new dependencies for packaging Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Traditionally, changes to the koha-*scripts have been backported to stable releases, so that the tools around package installations are the same, no matter what version they are running. Could/should this be considered for the present bug too, or is it too big a leap to incorporate it into the stable branches?
Applies cleanly to 3.20.5. Needs tiny fix for 3.18.12 in debian/control. Adds new dependencies (not mandatory if koha-plack is not used). Needs Apache 2.4 (Debian Jessie, Ubuntu ?).