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>
This commit is contained in:
parent
5562b26bb0
commit
1a81cf9bc7
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha Elasticsearch indexer daemon for %i
|
||||
Documentation=man:koha-es-indexer(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ StartLimitBurst=3
|
|||
Type=simple
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-es-indexer
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha Zebra indexer daemon for %i
|
||||
Documentation=man:koha-indexer(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-zebra@%i.service koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-zebra@%i.service koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ StartLimitBurst=3
|
|||
Type=simple
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-indexer
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha Plack server for %i
|
||||
Documentation=man:koha-plack(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ StartLimitBurst=3
|
|||
Type=forking
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-plack
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
@ -21,7 +24,6 @@ ExecStart=/usr/bin/starman \
|
|||
-M FindBin \
|
||||
--max-requests ${PLACK_MAX_REQUESTS} \
|
||||
--workers ${PLACK_WORKERS} \
|
||||
--user %i-koha --group %i-koha \
|
||||
--pid /run/koha/%i/plack.pid \
|
||||
--daemonize \
|
||||
--access-log /var/log/koha/%i/plack.log \
|
||||
|
|
@ -30,6 +32,10 @@ ExecStart=/usr/bin/starman \
|
|||
--listen /run/koha/%i/plack.sock \
|
||||
${PLACK_PSGIFILE}
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
# Starman shuts down gracefully on QUIT (TERM is immediate); matches the
|
||||
# QUIT/30/KILL/5 retry schedule the SysV path used.
|
||||
KillSignal=SIGQUIT
|
||||
TimeoutStopSec=30s
|
||||
ProtectSystem=full
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha SIP server for %i
|
||||
Documentation=man:koha-sip(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
AssertPathExists=/etc/koha/sites/%i/SIPconfig.xml
|
||||
|
||||
StartLimitIntervalSec=60
|
||||
|
|
@ -12,6 +14,7 @@ StartLimitBurst=3
|
|||
Type=simple
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-sip
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha background worker (long_tasks queue) for %i
|
||||
Documentation=man:koha-worker(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ StartLimitBurst=3
|
|||
Type=simple
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-worker-long_tasks
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
@ -19,6 +22,10 @@ ProtectSystem=full
|
|||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=yes
|
||||
# The worker forks a child per job: signal only the parent and give running
|
||||
# jobs a chance to finish before the remaining processes are killed.
|
||||
KillMode=mixed
|
||||
TimeoutStopSec=120s
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha background worker (default queue) for %i
|
||||
Documentation=man:koha-worker(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ StartLimitBurst=3
|
|||
Type=simple
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-worker
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
@ -19,6 +22,10 @@ ProtectSystem=full
|
|||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
NoNewPrivileges=yes
|
||||
# The worker forks a child per job: signal only the parent and give running
|
||||
# jobs a chance to finish before the remaining processes are killed.
|
||||
KillMode=mixed
|
||||
TimeoutStopSec=120s
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha Z39.50/SRU server for %i
|
||||
Documentation=man:koha-z3950-responder(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ StartLimitBurst=3
|
|||
Type=forking
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-z3950
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
[Unit]
|
||||
Description=Koha Zebra indexing server for %i
|
||||
Documentation=man:koha-zebra(8)
|
||||
PartOf=koha@%i.target
|
||||
Requires=koha-create-dirs@%i.service
|
||||
After=koha@%i.target koha-create-dirs@%i.service
|
||||
Before=koha@%i.target
|
||||
After=koha-create-dirs@%i.service
|
||||
StartLimitIntervalSec=60
|
||||
StartLimitBurst=3
|
||||
|
||||
|
|
@ -10,13 +12,14 @@ StartLimitBurst=3
|
|||
Type=forking
|
||||
User=%i-koha
|
||||
Group=%i-koha
|
||||
SyslogIdentifier=%i-koha-zebra
|
||||
WorkingDirectory=/var/lib/koha/%i
|
||||
Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml
|
||||
Environment=KOHA_HOME=/usr/share/koha
|
||||
PIDFile=/run/koha/%i/zebra.pid
|
||||
ExecStartPre=+/usr/sbin/koha-generate-env zebra %i
|
||||
# Clean up leftover Zebra socket files so Zebra can rebind on startup.
|
||||
ExecStartPre=+/bin/rm -f /run/koha/%i/bibliosocket /run/koha/%i/authoritysocket
|
||||
ExecStartPre=+/bin/sh -c 'rm -f /run/koha/%i/*socket'
|
||||
EnvironmentFile=-/run/koha/%i/zebra.env
|
||||
ExecStart=/usr/bin/zebrasrv \
|
||||
-v ${ZEBRA_LOGLEVELS} \
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
Description=Koha ILS instance %i
|
||||
After=network.target memcached.service mysql.service
|
||||
PartOf=koha.target
|
||||
Before=koha.target
|
||||
|
||||
[Install]
|
||||
WantedBy=koha.target
|
||||
|
|
|
|||
Loading…
Reference in New Issue