diff options
author | Jonathan Davies <jpds@protonmail.com> | 2023-11-04 14:19:14 +0000 |
---|---|---|
committer | Jonathan Davies <jpds@protonmail.com> | 2023-11-06 18:27:47 +0000 |
commit | 79e7841ff70dff996d1e64edc7cf2b7f65171114 (patch) | |
tree | 6daa8d995c9d5f125af9d84d035479a369539f55 /nixos/modules/services/web-servers | |
parent | 18894fb2de123bcd11a523ee2bb38b38cd4929aa (diff) |
nixos/caddy: Set systemd unit to restart on-failure whilst ignoring
error code 1.
This is what's recommended by systemd for long-running services and
helps with recovering from crashes.
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r-- | nixos/modules/services/web-servers/caddy/default.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/services/web-servers/caddy/default.nix b/nixos/modules/services/web-servers/caddy/default.nix index ce74e243a181..dcacb40e4681 100644 --- a/nixos/modules/services/web-servers/caddy/default.nix +++ b/nixos/modules/services/web-servers/caddy/default.nix @@ -376,7 +376,9 @@ in ReadWriteDirectories = cfg.dataDir; StateDirectory = mkIf (cfg.dataDir == "/var/lib/caddy") [ "caddy" ]; LogsDirectory = mkIf (cfg.logDir == "/var/log/caddy") [ "caddy" ]; - Restart = "on-abnormal"; + Restart = "on-failure"; + RestartPreventExitStatus = 1; + RestartSecs = "5s"; # TODO: attempt to upstream these options NoNewPrivileges = true; |