@cryptotaxi247 / infra-1 / commits / 54e4fa78

hydra: prune build logs older than 3y

We currently hold over 430GiB of build logs, which makes up 25% of the total disk space used on mimas.

Martin Weinelt committed Dec 6, 2024 at 03:42 UTC 54e4fa788ea9a2c0a9c3b1d2d14dcbf7a325a52b
1 file changed +18
build/hydra.nix
+18
@@ -22,6 +22,24 @@ in
22 # gc outputs as well, since they are served from the cache
23 nix.settings.gc-keep-outputs = false;
24
25 + systemd.services.hydra-prune-build-logs = {
26 + description = "Clean up old build logs";
27 + startAt = "weekly";
28 + serviceConfig = {
29 + User = "hydra-queue-runner";
30 + Group = "hydra";
31 + ExecStart = lib.concatStringsSep " " [
32 + (lib.getExe pkgs.findutils)
33 + "/var/lib/hydra/build-logs/"
34 + "-type"
35 + "f"
36 + "-mtime"
37 + "+${toString (3 * 365)}"
38 + "-delete"
39 + ];
40 + };
41 + };
42 +
43 # Don't rate-limit the journal.
44 services.journald.rateLimitBurst = 0;
45