commit 1e77cad0248f205f3c482949361f9f4c2e74b8d9
parent 1368bc38840eddc9eb3718b6253b830109c86907
Author: Florian Dold <dold@taler.net>
Date: Tue, 8 Sep 2026 00:46:10 +0200
services: apply DD102 restart and socket policy
Diffstat:
6 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/debian/challenger-httpd.challenger.target b/debian/challenger-httpd.challenger.target
@@ -0,0 +1,7 @@
+[Unit]
+Description=Challenger services
+Wants=postgresql.service challenger-httpd.service
+After=postgresql.service network.target
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/challenger-httpd.prerm b/debian/challenger-httpd.prerm
@@ -6,4 +6,6 @@ if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop 'challenger-httpd.service' >/dev/null || true
fi
+#DEBHELPER#
+
exit 0
diff --git a/debian/challenger-httpd.service b/debian/challenger-httpd.service
@@ -1,26 +1,22 @@
[Unit]
+PartOf=challenger.target
+StartLimitIntervalSec=0
Description=Challenger backend
After=postgresql.service network.target
Requires=challenger-httpd.socket
[Service]
+# DD102: retry transient failures without a start-rate limit.
+Restart=always
+RestartSec=10s
User=challenger-httpd
Type=simple
-Restart=always
RestartMode=direct
-RestartSec=1s
# Only restart when for status 9=EXIT_NO_RESTART
# In other cases (can't connect to database, ...) we restart
-RestartPreventExitStatus=9
+RestartPreventExitStatus=6 9
-# Disable the service if more than 5 restarts are encountered within 5s.
-# These are usually the systemd defaults, but can be overwritten, thus we set
-# them here explicitly, as the exchange code assumes StartLimitInterval
-# to be >=5s.
-StartLimitBurst=5
-StartLimitInterval=5s
-RuntimeMaxSec=3600s
ExecStart=/usr/bin/challenger-httpd -c /etc/challenger/challenger.conf -L INFO
StandardOutput=journal
StandardError=journal
diff --git a/debian/challenger-httpd.socket b/debian/challenger-httpd.socket
@@ -1,4 +1,5 @@
[Unit]
+BindsTo=challenger-httpd.service
Description=Challenger Socket
[Socket]
diff --git a/debian/rules b/debian/rules
@@ -29,9 +29,10 @@ override_dh_auto_clean:
dh_auto_clean
override_dh_installsystemd:
- dh_installsystemd -pchallenger-httpd --name=challenger-httpd --no-start --no-enable
+ dh_installsystemd -pchallenger-httpd --name=challenger --no-start --no-enable --no-stop-on-upgrade
+ dh_installsystemd -pchallenger-httpd --name=challenger-httpd --no-start --no-enable --no-stop-on-upgrade
# final invocation to generate daemon reload
- dh_installsystemd
+ dh_installsystemd --no-start --no-enable --no-stop-on-upgrade
override_dh_install:
dh_install
diff --git a/src/challenger/challenger-httpd.c b/src/challenger/challenger-httpd.c
@@ -512,7 +512,7 @@ start_daemon (void *cls,
MHD_OPTION_END);
if (NULL == mhd)
{
- global_ret = EXIT_NO_RESTART;
+ global_ret = EXIT_FAILURE;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to launch HTTP daemon.\n");
GNUNET_SCHEDULER_shutdown ();
@@ -804,7 +804,7 @@ run (void *cls,
if (NULL ==
(CH_context = CHALLENGERDB_connect (config)))
{
- global_ret = EXIT_NOTINSTALLED;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -825,7 +825,7 @@ run (void *cls,
case GNUNET_NO:
if (! have_daemons)
{
- global_ret = EXIT_NOTCONFIGURED;
+ global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -870,6 +870,6 @@ main (int argc,
if (GNUNET_NO == ret)
return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return EXIT_INVALIDARGUMENT;
+ return EXIT_NOTCONFIGURED;
return global_ret;
}