Commit 79e7841f authored by Jonathan Davies's avatar Jonathan Davies
Browse files

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.
parent 18894fb2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;