diff --git a/hosts/nixos/hs/containers.nix b/hosts/nixos/hs/containers.nix index c8c9707..2f81b84 100644 --- a/hosts/nixos/hs/containers.nix +++ b/hosts/nixos/hs/containers.nix @@ -441,6 +441,33 @@ in autoStart = true; }; + # Watchtower for automatic container updates + watchtower = { + image = "containrrr/watchtower:latest"; + + volumes = [ + "/var/run/podman/podman.sock:/var/run/docker.sock" + "/etc/localtime:/etc/localtime:ro" + ]; + + environment = { + WATCHTOWER_SCHEDULE = "0 0 5 * * *"; # Daily at 5 AM + WATCHTOWER_CLEANUP = "true"; # Remove old images after update + WATCHTOWER_NOTIFICATIONS = "gotify"; + WATCHTOWER_NOTIFICATION_GOTIFY_URL = "https://notify.yanlincs.com"; + WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN = "Ac9qKFH5cA.7Yly"; + WATCHTOWER_NOTIFICATION_GOTIFY_TITLE = "Watchtower Update"; + WATCHTOWER_NOTIFICATIONS_LEVEL = "info"; + TZ = systemTZ; + }; + + extraOptions = [ + "--network=podman" + ]; + + autoStart = true; + }; + # Nextcloud cloud storage and file sharing cloud = { image = "docker.io/linuxserver/nextcloud:latest"; diff --git a/scripts/borg-integrity-check.sh b/scripts/borg-integrity-check.sh index 62da0ff..f5491d9 100755 --- a/scripts/borg-integrity-check.sh +++ b/scripts/borg-integrity-check.sh @@ -88,7 +88,7 @@ if ! run_borg_check "--repository-only" "Repository consistency"; then CHECK_DURATION=$((CHECK_END - CHECK_START)) send_notification "critical" \ - "[$HOSTNAME] Borg Check Failed" \ + "Borg Check Failed" \ "Repository consistency check failed!\n\nRepository: $REPO_URL\nDuration: ${CHECK_DURATION}s\n\nErrors:\n$ERRORS_FOUND\n\nImmediate attention required!" exit 1 @@ -176,7 +176,7 @@ if [ "$CHECK_RESULT" = "SUCCESS" ]; then echo -e "$SUCCESS_MSG" send_notification "normal" \ - "[$HOSTNAME] Borg Check Passed" \ + "Borg Check Passed" \ "$SUCCESS_MSG" else FAILURE_MSG="Integrity check found issues for $HOSTNAME\n\n" @@ -191,7 +191,7 @@ else echo -e "$FAILURE_MSG" send_notification "high" \ - "[$HOSTNAME] Borg Check Issues" \ + "Borg Check Issues" \ "$FAILURE_MSG" # Exit with error code to indicate failure