diff --git a/README.md b/README.md index c387cf4..9da37ad 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ NTFY_ENABLED=true NTFY_TITLE="Docker Update ($(hostname))" NTFY_TOKEN="DEIN_TOKEN" NTFY_URL="https://ntfy.example.com/topic" +NTFY_IMAGE_URL="http://dein-server/host-icon.png" NTFY_TAGS="docker,update" NTFY_ONLY_ON_CHANGES=false # Versions Nr. anzeigen (true/false) diff --git a/config.conf b/config.conf index 3b7b29e..47358fb 100644 --- a/config.conf +++ b/config.conf @@ -49,6 +49,7 @@ NTFY_ENABLED=true NTFY_TITLE="Docker Update ($(hostname))" NTFY_TOKEN="DEIN_TOKEN" NTFY_URL="https://ntfy.example.com/topic" +NTFY_IMAGE_URL="http://dein-server/host-icon.png" NTFY_TAGS="docker,update" NTFY_ONLY_ON_CHANGES=false # Versions Nr. anzeigen (true/false) diff --git a/config.conf_ b/config.conf_ new file mode 100644 index 0000000..57ab661 --- /dev/null +++ b/config.conf_ @@ -0,0 +1,87 @@ +# ============================= +# ============================= +# Pfade +# ============================= + +# Pfad zu deinen Compose-Files +COMPOSE_DIR="/pfad/zu/deinen/stacks" +# Logging +LOG_FILE="/pfad/zum/log/update.log" +LOG_LEVEL="INFO" # DEBUG=sehr detailliert, INFO=Standard, WARN=nur wichtige Hinweise/Updates, ERROR=nur Fehler + +# Dateimuster +COMPOSE_PATTERN="docker-compose.yml" + +# ============================= +# ============================= +# Allgemein Einstellungen +# ============================= + +# Verhalten bei gestoppten Containern +UPDATE_STOPPED=true # Image aktualisieren +START_STOPPED=false # danach NICHT starten + +# Dry Run (true/false) +DRY_RUN=false + +# ============================= +# ============================= +# Exclude +# ============================= + +# Exclude Container +EXCLUDE_SERVICES=( + "example_container_1" + "example_container_2" +) + +# Exclude Stack +EXCLUDE_STACKS=( + "example_stack_1" + "example_stack_2" +) + +# ============================= +# ============================= +# NTFY +# ============================= +NTFY_ENABLED=true +NTFY_TITLE="Docker Update ($(hostname))" +NTFY_TOKEN="DEIN_TOKEN" +NTFY_URL="https://ntfy.example.com/topic" +NTFY_IMAGE_URL="http://dein-server/composeupdater.png" +NTFY_TAGS="docker,update" +NTFY_ONLY_ON_CHANGES=false +# Versions Nr. anzeigen (true/false) +SHOW_VERSIONS=true + +# ============================= +# ============================= +# Docker Cleanup +# ============================= + +ENABLE_CLEANUP=true +CLEANUP_ONLY_ON_UPDATE=true + +# Images: +# 🟢 dangling → docker image prune (nur Images) +# 🟢 unused → docker image prune -a (alle ungenutzten Images) +CLEANUP_IMAGES=true +CLEANUP_IMAGES_MODE="unused" # dangling | unused + +# Container: +# entfernt gestoppte Container +# 🟢 docker container prune +CLEANUP_CONTAINERS=true + +# Volume: +# entfernt ungenutzte Volumes +# ⚠️ kann Daten löschen +CLEANUP_VOLUMES=false + +# Networks: +# entfernt ungenutzte Netzwerke +# 🟢 meist unkritisch +CLEANUP_NETWORKS=true + +# ============================= \ No newline at end of file diff --git a/shell_docker_compose_update.sh b/shell_docker_compose_update.sh index fe204c8..f1e3671 100644 --- a/shell_docker_compose_update.sh +++ b/shell_docker_compose_update.sh @@ -2,7 +2,7 @@ set -euo pipefail -BASE_DIR="$(dirname "$0")" +BASE_DIR="$(cd "$(dirname "$0")" && pwd)" source "$BASE_DIR/config.conf" mkdir -p "$(dirname "$LOG_FILE")" @@ -120,14 +120,26 @@ run_cmd() { send_ntfy() { local msg="$1" local prio="$2" + local image_url="${NTFY_IMAGE_URL:-}" - curl -s \ - -H "Authorization: Bearer $NTFY_TOKEN" \ - -H "Title: $NTFY_TITLE" \ - -H "Priority: $prio" \ - -H "Tags: $NTFY_TAGS" \ - -d "$msg" \ - "$NTFY_URL" > /dev/null || true + if [ -n "$image_url" ]; then + curl -s \ + -H "Authorization: Bearer $NTFY_TOKEN" \ + -H "Title: $NTFY_TITLE" \ + -H "Priority: $prio" \ + -H "Tags: $NTFY_TAGS" \ + -H "Icon: $image_url" \ + -d "$msg" \ + "$NTFY_URL" > /dev/null || true + else + curl -s \ + -H "Authorization: Bearer $NTFY_TOKEN" \ + -H "Title: $NTFY_TITLE" \ + -H "Priority: $prio" \ + -H "Tags: $NTFY_TAGS" \ + -d "$msg" \ + "$NTFY_URL" > /dev/null || true + fi } get_docker_disk_usage() {