From d1b633b086e4fa1d5365fba27b6e70d7bab477c0 Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Fri, 14 Jun 2024 20:17:21 +0200 Subject: [PATCH] Add autorestic ntfy notifications --- hosts/franz/restic.nix | 24 ++++++++++++++++++++++++ secrets/franz.yaml | 5 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/hosts/franz/restic.nix b/hosts/franz/restic.nix index c275581..ad6f80f 100644 --- a/hosts/franz/restic.nix +++ b/hosts/franz/restic.nix @@ -52,6 +52,9 @@ in { sops.secrets."autorestic/eustachius_key" = { owner = vars.user; }; + sops.secrets."autorestic/ntfy_access_token" = { + owner = vars.user; + }; sops.templates.".autorestic.yml" = { path = "/home/${vars.user}/.autorestic.yml"; @@ -63,6 +66,15 @@ in { forget: keep-weekly: 7 keep-monthly: 12 + + extras: + default_hooks: &default_hooks + success: + - 'curl -H "Authorization: Bearer ${config.sops.placeholder."autorestic/ntfy_access_token"}" -H "X-Tags: white_check_mark" -H "X-Title: Backup of location $AUTORESTIC_LOCATION successful" -d "Added $AUTORESTIC_FILES_ADDED_0 files and changed $AUTORESTIC_FILES_CHANGED_0 files with a total size of $AUTORESTIC_ADDED_SIZE_0. Processed $AUTORESTIC_PROCESSED_FILES_0 files with total size $AUTORESTIC_PROCESSED_SIZE_0 in $AUTORESTIC_PROCESSED_DURATION_0. Snapshot $AUTORESTIC_SNAPSHOT_ID_0" https://push.ghoscht.com/autorestic-log' + failure: + - 'curl -H "Authorization: Bearer ${config.sops.placeholder."autorestic/ntfy_access_token"}" -H "X-Tags: warning" -H "X-Title: Backup Failure" -d "Backup of location $AUTORESTIC_LOCATION failed" https://push.ghoscht.com/autorestic' + - 'curl -H "Authorization: Bearer ${config.sops.placeholder."autorestic/ntfy_access_token"}" -H "X-Tags: warning" -H "X-Title: Backup Failure" -d "Backup of location $AUTORESTIC_LOCATION failed" https://push.ghoscht.com/autorestic-log' + locations: dashboard: from: /storage/dataset/docker/dashboard @@ -71,6 +83,7 @@ in { # - eustachius cron: '0 4 * * 0' # Every Sunday at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix stop after: @@ -83,6 +96,7 @@ in { # - eustachius cron: '0 4 * * 0' # Every Sunday at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix stop after: @@ -94,6 +108,7 @@ in { # - eustachius cron: '0 4 * * 0' # Every Sunday at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix stop after: @@ -106,6 +121,7 @@ in { # - eustachius cron: '0 4 * * *' # Every Day at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix stop after: @@ -118,6 +134,7 @@ in { # - eustachius cron: '0 4 * * *' # Every Day at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop after: @@ -130,6 +147,7 @@ in { # - eustachius cron: '0 4 * * *' # Every Day at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix stop after: @@ -141,6 +159,7 @@ in { # - eustachius cron: '0 4 * * 0' # Every Sunday at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix stop after: @@ -153,6 +172,7 @@ in { # - eustachius cron: '0 4 * * *' # Every Day at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix stop after: @@ -164,6 +184,7 @@ in { # - eustachius cron: '0 4 * * 0' # Every Sunday at 4:00 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/matrix/arion-compose.nix -p ${arionPath}/matrix/arion-pkgs.nix stop after: @@ -174,6 +195,7 @@ in { # - eustachius # cron: '0 4 * * 0' # Every Sunday at 4:00 # hooks: + # <<: *default_hooks # before: # - arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop # after: @@ -184,6 +206,7 @@ in { - zfs cron: '55 3 * * *' # Every Day at 3:55 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/headscale/arion-compose.nix -p ${arionPath}/headscale/arion-pkgs.nix stop after: @@ -196,6 +219,7 @@ in { # - eustachius cron: '55 3 * * *' # Every Day at 3:55 hooks: + <<: *default_hooks before: - arion -f ${arionPath}/auth/arion-compose.nix -p ${arionPath}/auth/arion-pkgs.nix stop after: diff --git a/secrets/franz.yaml b/secrets/franz.yaml index 9c25992..7bc90fe 100644 --- a/secrets/franz.yaml +++ b/secrets/franz.yaml @@ -31,6 +31,7 @@ autorestic: zfs_key: ENC[AES256_GCM,data:HyZBD202BoG6ncw37Tg9LPvfvQPnOaLJKk+gMvdZflt+XZ/7lx6TZOp/loiDhSSBTMusAXaI/aDkAFx2a7yDUQ==,iv:nQAHi9TyUXamSlFq99NYvWLOBSuZstuYNJLgVpxF1JU=,tag:mIS/E4Wr6IdWsZtehNY7UA==,type:str] ssd_key: ENC[AES256_GCM,data:xgJCpNkmIn8VU+jG++0kLW8WM9RbTBmsZeOuOz1WWmc4sOdN4lWfPvLjcTAHZDIXFvX7NodEcGAYDmcWNw7QBw==,iv:wGJcz7CEjhwsUlVEyuHOBcayzE97PfWi2f0TvITzafg=,tag:wpaJFcQBd/kAmExfD6fwJQ==,type:str] eustachius_key: ENC[AES256_GCM,data:qiq6Y05bV7mf0OOBDzR09MrW5g01WxmWVHB3vJ04XQaOVMGzl7hZq0ewcLOxitbFw3VcN5GQBpA8smlmahz8VA==,iv:epq7+tXG9QYAjNu8qHI2gjBYUuoPNdZg8+2XCLOwu1Q=,tag:qM8YdSZhwwM3GDrNPfo/Jg==,type:str] + ntfy_access_token: ENC[AES256_GCM,data:BH1/tNYDj2ggzdNByQDYT0cu9hGTgaGEjXUv4HdqO1M=,iv:nq+frAIoNr8uCwGadOqdAP90kjukVTSq3Tc8hWbCi3Q=,tag:r92qKR78keQVgI/VMXipvw==,type:str] matrix: postgres_database: ENC[AES256_GCM,data:9O0vYjbTuQ==,iv:L5QCwhFSjPW0OiUMjCQo6BcLktUXJcqTsTXEi5JdaWo=,tag:LUPRSZl0pza5WOWI8RrAmw==,type:str] postgres_user: ENC[AES256_GCM,data:S9ksmTOAbBg=,iv:q/6Oo9JhiSAqQq3ZKa0dbQGtfYAuD0oeiDLR4YwV0nk=,tag:RIc/1UVs88Jg8+4zGnW6vQ==,type:str] @@ -65,8 +66,8 @@ sops: VUUxcEhvYi8zeXlCUUViUTl0eWdhcU0KXOfbnDc+zc8lnBcyEAV5EiJSjcSU6AgI EfeRw8qVqwChrYn1agslcNnDbE0WQsOCBuA6cE4V3kRofp9HU949ig== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-06-14T10:23:38Z" - mac: ENC[AES256_GCM,data:pAnnmK5w7KFkXJIVxl3joMxEAcWwGoqBDr+Qa1mE61u+Lp+vM2Um8xgyEaTezk7/thcKaOU4ELwXjXG7pr0yESQDeNPMZxXfU/XZH913DB0g58IwiJY4dUL827eiIj7TfbdUcxeTXOD6/GlfrRBVTDPDPLBzdNxMC2jeZ5hPDvY=,iv:pD2lXmcWGxgSVfAxkOr8pFQkv6c7y+940w/zigJhAlo=,tag:CxQA34iU5bsUppsxgH++Uw==,type:str] + lastmodified: "2024-06-14T16:33:02Z" + mac: ENC[AES256_GCM,data:tifzRssqaaej73Tm8bqcms0hrjQ27E7VY1UwfQ/oPXGYxtEdI3FRdDie7yRxOuaquX5JXcJquQyTKrHEXbUakwqddSsws3uKkdy8dfjmTbpGWjKUPnPASsix2l028ov1jIeQ80/QfMavtSmy/1ZI7O/cVGy9FMV0wFysEWMJ+KI=,iv:Nolz/xL+jifstC1sw1IzI7Fu3fR+6+TBMWjl7PQZGh4=,tag:jxVt7kCQwfTKdbd8CLmesA==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.8.1