From 6f9099fa62b4d88ece219e02e603d65a4c69a5c9 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 10 May 2022 22:02:04 +0200 Subject: [PATCH] nixos/{jira,crowd,confluence}: restart service on failure In case of unexpected failures of the services - such as an OOM - it shouldn't be necessary for an administrator to restart the service by hand (which is usually sufficient). Instead, this should happen automatically. Also, I decided to increase the interval between restart attempts from 100ms[1] to 10s for a small grace period as suggested by several online resources[2][3]. [1] See `systemd.service(5)` [2] https://it.megocollector.com/linux/create-systemd-services-for-atlassian-apps/ [3] https://anteru.net/blog/2017/jira-confluence-with-systemd-on-centos/ --- nixos/modules/services/web-apps/atlassian/confluence.nix | 2 ++ nixos/modules/services/web-apps/atlassian/crowd.nix | 2 ++ nixos/modules/services/web-apps/atlassian/jira.nix | 2 ++ 3 files changed, 6 insertions(+) diff --git a/nixos/modules/services/web-apps/atlassian/confluence.nix b/nixos/modules/services/web-apps/atlassian/confluence.nix index 2d809c17ff0..28491fb3a4e 100644 --- a/nixos/modules/services/web-apps/atlassian/confluence.nix +++ b/nixos/modules/services/web-apps/atlassian/confluence.nix @@ -189,6 +189,8 @@ in User = cfg.user; Group = cfg.group; PrivateTmp = true; + Restart = "on-failure"; + RestartSec = "10"; ExecStart = "${pkg}/bin/start-confluence.sh -fg"; ExecStop = "${pkg}/bin/stop-confluence.sh"; }; diff --git a/nixos/modules/services/web-apps/atlassian/crowd.nix b/nixos/modules/services/web-apps/atlassian/crowd.nix index a8b2482d5a9..79306541b85 100644 --- a/nixos/modules/services/web-apps/atlassian/crowd.nix +++ b/nixos/modules/services/web-apps/atlassian/crowd.nix @@ -157,6 +157,8 @@ in User = cfg.user; Group = cfg.group; PrivateTmp = true; + Restart = "on-failure"; + RestartSec = "10"; ExecStart = "${pkg}/start_crowd.sh -fg"; }; }; diff --git a/nixos/modules/services/web-apps/atlassian/jira.nix b/nixos/modules/services/web-apps/atlassian/jira.nix index a120f6cdb3d..bc0bf43522e 100644 --- a/nixos/modules/services/web-apps/atlassian/jira.nix +++ b/nixos/modules/services/web-apps/atlassian/jira.nix @@ -197,6 +197,8 @@ in User = cfg.user; Group = cfg.group; PrivateTmp = true; + Restart = "on-failure"; + RestartSec = "10"; ExecStart = "${pkg}/bin/start-jira.sh -fg"; ExecStop = "${pkg}/bin/stop-jira.sh"; };