Skip to content

Commit

Permalink
[OPS-1402] Add systemd unit restart policy
Browse files Browse the repository at this point in the history
Problem: By default, systemd services generated from the NixOS system configuration don't attempt to restart on failure since Restart=no. However, in some cases, running processes can fail for unclear reasons, and the simplest way to bring the failed service back to life is to restart it. Instead, currently, the service will fail and trigger an alert without attempting to restart.

Solution: Add default values for startLimitBurst, startLimitIntervalSec, Restart, and RestartSec.
  • Loading branch information
Sereja313 committed Jan 17, 2024
1 parent a5122e1 commit f882147
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/cors-proxy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ in {
script = ''
${cfg.package}/bin/@isomorphic-git/cors-proxy start
'';
startLimitBurst = 5;
startLimitIntervalSec = 300;
serviceConfig = {
Restart = "on-failure";
RestartSec = 10;
};
environment = {
PORT = toString cfg.port;
ALLOW_ORIGIN = cfg.allowOrigin;
Expand Down

0 comments on commit f882147

Please sign in to comment.