picard healthchecks

This commit is contained in:
Philipp Hochkamp 2022-05-12 02:18:49 +02:00
parent 8d62eb3a63
commit 44e6454788
No known key found for this signature in database
GPG key ID: 3676AB4CB36E5641
3 changed files with 15 additions and 0 deletions

View file

@ -43,6 +43,7 @@
services.postgresql.package = pkgs.postgresql_13;
ragon.agenix.secrets."picardResticPassword" = { };
ragon.agenix.secrets."picardResticSSHKey" = { };
ragon.agenix.secrets."picardResticHealthCheckUrl" = { };
services.nginx.virtualHosts."xyno.space" = {
enableACME = true;
@ -69,6 +70,19 @@
};
systemd.services.restic-backups-picard = {
# ExecStartPost commands are only run if the ExecStart command succeeded
serviceConfig.ExecStartPost = pkgs.writeShellScript "backupSuccessful" ''
${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(cat ${config.age.secrets.picardResticHealthCheckUrl.path})
'';
unitConfig.OnFailure = "backupFailure.service";
};
systemd.services.backupFailure = {
enable = true;
script = "${pkgs.curl}/bin/curl -fss -m 10 --retry 5 -o /dev/null $(cat ${config.age.secrets.picardResticHealthCheckUrl.path})/fail";
};
ragon = {
cli.enable = true;
user.enable = true;

Binary file not shown.

View file

@ -20,4 +20,5 @@ in
"nextcloudAdminPass.age".publicKeys = pubkeys.ragon.host "picard";
"picardResticSSHKey.age".publicKeys = pubkeys.ragon.host "picard";
"picardResticPassword.age".publicKeys = pubkeys.ragon.host "picard";
"picardResticHealthCheckUrl.age".publicKeys = pubkeys.ragon.host "picard";
}