Skip to content

Commit

Permalink
website: Clear old generations on dev
Browse files Browse the repository at this point in the history
With chaos-jetzt/website_pelican#33, a lot of
orphans are to be expected which will take up space on our servers. This
introduces a timer which runs once a week and will delete any
website generations older than 28 days.
  • Loading branch information
e1mo committed Jul 22, 2023
1 parent 5442317 commit c1eebe1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/website.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,14 @@ in {
chown -R web-deploy:${config.services.nginx.group} ${webroot}
fi
'';

# Delete dev website builds older than 28 days
systemd.services."website-purge-old" = lib.mkIf isDev {
path = with pkgs; [ fd ];
script = ''
fd --print0 --changed-before 28d --type d --max-depth 1 --min-depth 1 . ${webroot} --exec-batch rm -vr {} \;
'';
startAt = "weekly";
serviceConfig.User = "web-deploy";
};
}

0 comments on commit c1eebe1

Please sign in to comment.