Bug 18617 - starting plack on reboot can fail on non-standard apache configs
Summary: starting plack on reboot can fail on non-standard apache configs
Status: CLOSED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Liz Rea
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-16 22:54 UTC by Liz Rea
Modified: 2018-12-03 20:03 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 18617 - starting plack on reboot can fail on non-standard apache configs (2.82 KB, patch)
2017-05-17 00:02 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 18617: Follow up - correctly check plack.enabled file first (1.25 KB, patch)
2018-01-26 18:38 UTC, Mark Tompsett
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Liz Rea 2017-05-16 22:54:59 UTC
If you have a non-standard Koha apache configuration, for example you have virtualhosts in separate files instead of all in one file (you might do this if you were using Let's Encrypt, among other reasons) koha-list --plack --enabled can fail because it is looking for apache configurations in only one file (/etc/apache2/sites-available/instance.conf).

I propose to make the check for plack enabled work more like the email enabled, where we touch a file in /var/lib/koha/instance when the service is enabled, and remove it when it is disabled. I'm happy to leave the current checking alone and include this as a bracer to the existing belt.

To do:

edit koha-plack to make enable and disable put a file in /var/lib/koha/instance called plack.enable

edit koha-functions.sh to include checking for the file as part of is_plack_enabled

There are probably other things to do as well.
Comment 1 Liz Rea 2017-05-17 00:02:33 UTC
Created attachment 63493 [details] [review]
Bug 18617 - starting plack on reboot can fail on non-standard apache configs

To test:
apply this patch
copy debian/scripts/koha-functions.sh to /usr/share/koha/bin
copy debian/scripts/koha-plack to /usr/sbin

create a dummy instance if you need to (koha-create --create-db whatever)
enable plack - koha-plack --enable whatever
check for existence of /var/lib/koha/whatever/plack.enabled
do a koha-list --enabled --plack and your instance should be listed as enabled.
rename your /etc/apache2/sites-available/whatever.conf to something else
do a koha-list --enabled --plack - it should still be enabled
do a koha-plack --disable whatever - it should remove /var/lib/koha/whatever/plack.enabled
do a koha-list --enabled --plack - it should not be listed.

Note:
This does not deal with the issue of disabling plack not doing the right thing for config files that are not "/etc/apache2/sites-available/whatever.conf" - this only ensures that koha-list --enabled and --disabled reports correctly in that circumstance.
Comment 2 Liz Rea 2017-06-22 01:37:55 UTC
Bump, we'll need this if we want to ever split up the apache configuration files as we should.
Comment 3 Mark Tompsett 2017-06-23 19:26:41 UTC
(In reply to Liz Rea from comment #2)
> Bump, we'll need this if we want to ever split up the apache configuration
> files as we should.

I vaguely recall that LetsEncrypt does not like split config files.
Comment 4 Liz Rea 2017-06-26 21:50:03 UTC
Do you have objections that are further to the actual function here, because I don't really want to look up and document every bit of certbot to defend that. I have directly experienced the plack problem with vhosts in separate files, it ought to be enough to justify the change.

Cheers,
Liz
Comment 5 Mark Tompsett 2018-01-26 18:35:30 UTC
I like the idea of not having to grep the apache configuration files. I was testing this, and discovered that this doesn't fully work. I'm going to attach a follow up which should. If that makes you happy, Liz, then sign off, and I'll sign off, and we can set this to signed off.
Comment 6 Mark Tompsett 2018-01-26 18:38:22 UTC
Created attachment 70971 [details] [review]
Bug 18617: Follow up - correctly check plack.enabled file first

This patch was required, because without it, the apache2
config grepping logic was preventing the elif from checking
the existence of the enabled file.