Commit Graph

4 Commits

Author SHA1 Message Date
Martin Renvoize 1a81cf9bc7
Bug 40901: (QA follow-up) Polish the per-component units
- Order services Before= their instance target instead of After=. With
  After=, koha@<inst>.target (and therefore koha.target) reported active
  before a single daemon had started, so its state meant nothing to
  anything ordered after Koha. koha@.target is likewise Before=koha.target.
- Add SyslogIdentifier=%i-koha-<service> to every unit so journal lines
  can be filtered per instance and component (the template this series
  removed already did this) and Documentation= pointing at each helper's
  man page.
- koha-plack@: stop with SIGQUIT and a 30s timeout. Starman treats QUIT
  as graceful shutdown and TERM as immediate; the SysV path used
  QUIT/30/KILL/5, so the default SIGTERM cut in-flight requests on every
  restart. Drop the redundant --user/--group starman flags, User=/Group=
  already apply.
- koha-worker@, koha-worker-long_tasks@: KillMode=mixed with a 120s
  timeout so the parent is signalled but a running forked job gets a
  chance to finish before it is killed.
- koha-zebra@: remove every *socket file in the run directory rather
  than the two default names, so sites with customised <listen> entries
  get the same stale-socket protection.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-29 09:02:32 +00:00
Kyle M Hall 05228589ed
Bug 40901: (follow-up) Drop redundant StopWhenUnneeded on koha@.target
PartOf=koha.target already cascades stop to the per-instance target
so StopWhenUnneeded is not needed and adds more complication that could
trip us up later.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-29 09:01:58 +00:00
Tomás Cohen Arazi d67d319b89
Bug 40901: (follow-up) Preserve 'service koha-common' UX with systemd
Adds PartOf=koha.target to koha@.target so that stopping or
restarting the global target propagates to all instance targets
and their services.

Ships a koha-common.service oneshot unit that delegates to
koha.target, so 'systemctl restart koha-common' works as the
drop-in replacement for the old 'service koha-common restart'.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-29 09:01:44 +00:00
Tomás Cohen Arazi dc8cced6be
Bug 40901: Add koha-systemd package with native systemd units
This patch introduces the koha-systemd package, which provides native
systemd service units for managing Koha instances. Each service type
(Plack, Zebra, SIP, Z3950, workers, indexers) is managed as a separate
systemd unit using instance templates.

The package includes:
- 8 service templates (plack, zebra, sip, z3950, worker, worker-long,
  indexer, es-indexer)
- 2 target units (koha@.target for per-instance, koha.target for global)
- Helper script (koha-systemd-ctl) for managing services

All service units include:
- KOHA_HOME environment variable pointing to /usr/share/koha
- WorkingDirectory set to /var/lib/koha/%i
- Proper user/group permissions (%i-koha)

This allows granular control over individual services per instance and
leverages systemd features like dependency management, resource limits,
and journald logging.

Test plan:
1. Build and install the package
2. Enable services for an instance
3. Verify all services start correctly
4. Check journalctl logs show no errors

Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-29 09:01:21 +00:00