Skip to content

Commit a17992b

Browse files
committed
imp: apply a max runtime to ipfs service w/ restart to avoid oom
1 parent 91553e1 commit a17992b

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

flake/nixosModules/cardano-ipfs.nix

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,26 @@ in {
381381
};
382382
};
383383

384-
# Needed for kubo to `sh` to run the repo db migration process for upgrades
385-
systemd.services.ipfs.path = with pkgs; [bash];
384+
systemd.services.ipfs = {
385+
# Needed for kubo to `sh` to run the repo db migration process for upgrades
386+
path = with pkgs; [bash];
387+
388+
# Limit runtime to 1 week until a memory leak is addressed in future
389+
# ipfs updates.
390+
startLimitIntervalSec = 15 * 60;
391+
startLimitBurst = 3;
392+
393+
serviceConfig = {
394+
Restart = "always";
395+
RestartSec = 30;
396+
397+
RuntimeMaxSec = 7 * 24 * 3600;
398+
399+
# Without this, the service won't restart on successful exist despite
400+
# the restart always.
401+
SuccessExitStatus = "";
402+
};
403+
};
386404

387405
sops.secrets = mkSopsSecret {
388406
secretName = "ipfs-auth";

0 commit comments

Comments
 (0)