diff --git a/config.json b/config.json index 09ccf09..2c151b6 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { - "modno": 14, + "modno": 16, "version": 4, "instance": "nuclide.systems", "repos": [ @@ -69,7 +69,8 @@ "/mnt/pve/unas/services/traccar", "/mnt/pve/unas/services/vaultwarden", "/mnt/pve/unas/services/shared-db-garage", - "/mnt/pve/unas/media/documents/public/paperless-ngx" + "/mnt/pve/unas/media/documents/public/paperless-ngx", + "/mnt/pve/unas/services/open-webui" ], "schedule": { "cron": "0 1 * * 1,2,3,4,5", @@ -107,6 +108,39 @@ "actionCommand": { "command": "bash /opt/backrest/scripts/n8n-prestage.sh" } + }, + { + "conditions": [ + "CONDITION_SNAPSHOT_SUCCESS" + ], + "actionGotify": { + "baseUrl": "http://192.168.1.40:10003", + "token": "AtIMGOYcZsb5HfO", + "priorityDefault": 3, + "template": "Plan: {{ .Plan.Id }}\nRepo: {{ .Repo.Id }}\nFiles new: {{ .SnapshotStats.FilesNew }}\nSize added: {{ formatSizeBytes .SnapshotStats.DataAdded }}\nDuration: {{ .Duration }}\nSnapshot: {{ .SnapshotId }}", + "titleTemplate": "\u2713 Backrest: {{ .Plan.Id }} succeeded" + } + }, + { + "conditions": [ + "CONDITION_SNAPSHOT_ERROR", + "CONDITION_SNAPSHOT_WARNING" + ], + "actionGotify": { + "baseUrl": "http://192.168.1.40:10003", + "token": "AtIMGOYcZsb5HfO", + "priorityDefault": 8, + "template": "Plan: {{ .Plan.Id }}\nRepo: {{ .Repo.Id }}\nError: {{ .Error }}\nDuration: {{ .Duration }}", + "titleTemplate": "\u2717 Backrest: {{ .Plan.Id }} FAILED" + } + }, + { + "conditions": [ + "CONDITION_SNAPSHOT_START" + ], + "actionCommand": { + "command": "bash /opt/backrest/scripts/openwebui-prestage.sh" + } } ] }, @@ -126,7 +160,34 @@ "monthly": 6, "yearly": 1 } - } + }, + "hooks": [ + { + "conditions": [ + "CONDITION_SNAPSHOT_SUCCESS" + ], + "actionGotify": { + "baseUrl": "http://192.168.1.40:10003", + "token": "AtIMGOYcZsb5HfO", + "priorityDefault": 3, + "template": "Plan: {{ .Plan.Id }}\nRepo: {{ .Repo.Id }}\nFiles new: {{ .SnapshotStats.FilesNew }}\nSize added: {{ formatSizeBytes .SnapshotStats.DataAdded }}\nDuration: {{ .Duration }}\nSnapshot: {{ .SnapshotId }}", + "titleTemplate": "\u2713 Backrest: {{ .Plan.Id }} succeeded" + } + }, + { + "conditions": [ + "CONDITION_SNAPSHOT_ERROR", + "CONDITION_SNAPSHOT_WARNING" + ], + "actionGotify": { + "baseUrl": "http://192.168.1.40:10003", + "token": "AtIMGOYcZsb5HfO", + "priorityDefault": 8, + "template": "Plan: {{ .Plan.Id }}\nRepo: {{ .Repo.Id }}\nError: {{ .Error }}\nDuration: {{ .Duration }}", + "titleTemplate": "\u2717 Backrest: {{ .Plan.Id }} FAILED" + } + } + ] }, { "id": "media-backup-plan", @@ -144,7 +205,34 @@ "monthly": 6, "yearly": 1 } - } + }, + "hooks": [ + { + "conditions": [ + "CONDITION_SNAPSHOT_SUCCESS" + ], + "actionGotify": { + "baseUrl": "http://192.168.1.40:10003", + "token": "AtIMGOYcZsb5HfO", + "priorityDefault": 3, + "template": "Plan: {{ .Plan.Id }}\nRepo: {{ .Repo.Id }}\nFiles new: {{ .SnapshotStats.FilesNew }}\nSize added: {{ formatSizeBytes .SnapshotStats.DataAdded }}\nDuration: {{ .Duration }}\nSnapshot: {{ .SnapshotId }}", + "titleTemplate": "\u2713 Backrest: {{ .Plan.Id }} succeeded" + } + }, + { + "conditions": [ + "CONDITION_SNAPSHOT_ERROR", + "CONDITION_SNAPSHOT_WARNING" + ], + "actionGotify": { + "baseUrl": "http://192.168.1.40:10003", + "token": "AtIMGOYcZsb5HfO", + "priorityDefault": 8, + "template": "Plan: {{ .Plan.Id }}\nRepo: {{ .Repo.Id }}\nError: {{ .Error }}\nDuration: {{ .Duration }}", + "titleTemplate": "\u2717 Backrest: {{ .Plan.Id }} FAILED" + } + } + ] } ], "auth": { diff --git a/scripts/openwebui-prestage.sh b/scripts/openwebui-prestage.sh new file mode 100755 index 0000000..ecb21cf --- /dev/null +++ b/scripts/openwebui-prestage.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +CT104="root@192.168.1.40" +STAGING="/mnt/pve/unas/services/open-webui" +rsync -rlptD --no-owner --no-group --delete \ + --exclude='cache/' --exclude='*.tmp' --exclude='*.log' \ + "$CT104":/opt/stacks/ai/open-webui/data/ "$STAGING/" +echo "[$(date)] openwebui-prestage: done ($(du -sh $STAGING | cut -f1))"