summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian.bosch@mayflower.de>2022-05-10 22:02:04 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2022-05-10 22:31:22 +0200
commit6f9099fa62b4d88ece219e02e603d65a4c69a5c9 (patch)
tree02732c3b4bf87e0518718199482d3d3cfbd83aa1
parent51770697ccd8776e756dad42e918f09bbb796a58 (diff)
downloadnixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.tar
nixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.tar.gz
nixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.tar.bz2
nixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.tar.lz
nixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.tar.xz
nixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.tar.zst
nixpkgs-6f9099fa62b4d88ece219e02e603d65a4c69a5c9.zip
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/
-rw-r--r--nixos/modules/services/web-apps/atlassian/confluence.nix2
-rw-r--r--nixos/modules/services/web-apps/atlassian/crowd.nix2
-rw-r--r--nixos/modules/services/web-apps/atlassian/jira.nix2
3 files changed, 6 insertions, 0 deletions
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";
       };