From 3c898dedc418681060bb64377f59eb53585b9ed3 Mon Sep 17 00:00:00 2001 From: Sid Sun Date: Sat, 5 Oct 2024 21:28:55 +0530 Subject: [PATCH] Update to upstream uptime-kuma 1.23.15 and introduce ntfy.sh integration Signed-off-by: Sid Sun --- Dockerfile | 2 +- README.md | 1 + docker-compose.yaml | 2 ++ replicator-snapshots.sh | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2010ca6..68c7242 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM louislam/uptime-kuma:1.23.13 +FROM louislam/uptime-kuma:1.23.15 USER root RUN apt update && \ diff --git a/README.md b/README.md index 4c2cef7..f89a3b1 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ However, there have been a few changes which (while won't break your setup) you 1. Backup and Restore time rhythm was changed on 18 August 2024. Backups happen every 5 mins and Restores every 6 mins. 2. If you've used replicator-kuma prior to 22 September 2024, your restic version is very outdated and likely created a v1 format repo; the new image comes with new restic version. v1 repos still work with the new binary but you should migrate to v2 by running `restic migrate upgrade_repo_v2` +3. As of release `1.23.15`, replicator-kuma supports notifying via ntfy.sh when backups are created and restores carried out. ### Contributions diff --git a/docker-compose.yaml b/docker-compose.yaml index 3cd07c3..30845fa 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,6 +15,7 @@ services: - AWS_ACCESS_KEY_ID=AKIAJAJSLTZCAZ4SRI5Q - AWS_SECRET_ACCESS_KEY=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 - RESTIC_PASSWORD=I9n7G7G0ZpDWA3GOcJbIuwQCGvGUBkU5 + - NTFY_URL=ntfy.sh/myreplicatorkuma replica: container_name: uptime-kuma-replica image: realsidsun/replicator-kuma:1.23.13 @@ -29,6 +30,7 @@ services: - AWS_ACCESS_KEY_ID=AKIAJAJSLTZCAZ4SRI5Q - AWS_SECRET_ACCESS_KEY=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 - RESTIC_PASSWORD=I9n7G7G0ZpDWA3GOcJbIuwQCGvGUBkU5 + - NTFY_URL=ntfy.sh/myreplicatorkuma volumes: uptime-kuma-main: diff --git a/replicator-snapshots.sh b/replicator-snapshots.sh index a9c9a4d..581ed96 100644 --- a/replicator-snapshots.sh +++ b/replicator-snapshots.sh @@ -9,6 +9,14 @@ PID=$! declare -a tables=("monitor" "monitor_tag" "tag" "monitor_notification" "notification" "monitor_group" "group" "status_page" "monitor_maintenance" "maintenance" "maintenance_status_page" "incident") +function notify_backup { + [ -n "$NTFY_URL" ] && curl -d "[$HOSTNAME] Replicator Kuma Backup Successful. Time: $(date)" $NTFY_URL +} + +function notify_restore { + [ -n "$NTFY_URL" ] && curl -d "[$HOSTNAME] Replicator Kuma Restored Successfully. Time: $(date)" $NTFY_URL +} + function dump_tables { echo 'dump_tables' # remove previous backup (if any) @@ -66,6 +74,7 @@ function restic_restore { start_kuma # clone latest to local cp /backup/{latest.json,local.json} + notify_restore else echo 'remote and local are in sync' fi @@ -86,6 +95,7 @@ function restic_backup { then echo 'running restic backup' restic backup $LOCAL_PATH + notify_backup else echo 'file is the same - skipping backup' fi