mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 18:07:46 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f374b5003 | ||
|
|
563dbb8b42 | ||
|
|
31bb2008b9 | ||
|
|
cfa74adc3d | ||
|
|
e2dbd69c5e | ||
|
|
98e996caa3 |
26
README.md
26
README.md
@@ -1,13 +1,15 @@
|
||||
<p align="center">
|
||||
<img src="extras/dockcheck_logo_by_booYah187.png" width="160" title="dockcheck">
|
||||
<img src="extras/dockcheck_colour.png" width="300" title="dockcheck">
|
||||
</p>
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/badge/bash-4.3-green?style=flat-square&logo=gnubash" alt="bash">
|
||||
<a href="https://www.gnu.org/licenses/gpl-3.0.html"><img src="https://img.shields.io/badge/license-GPLv3-red?style=flat-square" alt="GPLv3"></a>
|
||||
<img src="https://img.shields.io/github/v/tag/mag37/dockcheck?style=flat-square&label=release" alt="release">
|
||||
<br>
|
||||
<a href="https://ko-fi.com/mag37"><img src="https://img.shields.io/badge/-Ko--fi-grey?style=flat-square&logo=Ko-fi" alt="Buy me a Coffee"></a>
|
||||
<a href="https://liberapay.com/user-bin-rob/donate"><img src="https://img.shields.io/badge/-LiberaPay-grey?style=flat-square&logo=liberapay" alt="LiberaPay"></a>
|
||||
<a href="https://github.com/sponsors/mag37"><img src="https://img.shields.io/badge/-Sponsor-grey?style=flat-square&logo=github" alt="Github Sponsor"></a>
|
||||
<a href="https://www.paypal.com/donate/?business=P2V5MCWRGCNBG&no_recurring=0¤cy_code=SEK"><img src="https://img.shields.io/badge/-PayPal-grey?style=flat-square&logo=paypal" alt="PayPal donation"></a>
|
||||
</p>
|
||||
|
||||
<h2 align="center">CLI tool to automate docker image updates or notifying when updates are available.</h2>
|
||||
@@ -20,6 +22,10 @@
|
||||
___
|
||||
## :bell: Changelog
|
||||
|
||||
- **v0.6.9**: #
|
||||
- Bugfix: label logic didn't skip recreation (skipped pulling).
|
||||
- Added comma separated search filtering so you can selectively search exactly which containers to check/update.
|
||||
- eg: `dockcheck.sh -yp homer,dozzle`
|
||||
- **v0.6.8**:
|
||||
- Bugfix: Unbound variable in notify_v2.sh
|
||||
- New option: "DisplaySourcedFiles" *config* added to list what files get sourced
|
||||
@@ -28,20 +34,6 @@ ___
|
||||
- Added configurable default curl arguments
|
||||
- Consolidated and standardized notify template update notifications
|
||||
- Added curl error handling
|
||||
- **v0.6.6**: Notify_v2 bugfixes
|
||||
- Clearer readme and error messages
|
||||
- Sourcing templates from either project root or subdirectory
|
||||
- Consistent newline handling
|
||||
- Added (when using `-d`) days old message to notification title
|
||||
- Added ntfy self hosted domain option to config
|
||||
- jq fixes to templates (and properly using $jqbin)
|
||||
- **v0.6.5**: Refactored notification logic. See notify_templates/notify_v2.sh for upgrade steps.
|
||||
- Added helper functions to simplify sourcing files and executing functions if they exist.
|
||||
- Created notify_v2.sh wrapper script.
|
||||
- Simplified and consolidated notification logic within notify_v2.sh.
|
||||
- Added support for notification management via environment variables.
|
||||
- Moved notification secrets to **dockcheck.config**.
|
||||
- Added retries to wget/curl to not get empty responses when github is slow.
|
||||
___
|
||||
|
||||
|
||||
@@ -50,7 +42,7 @@ ___
|
||||
## :mag_right: `dockcheck.sh`
|
||||
```
|
||||
$ ./dockcheck.sh -h
|
||||
Syntax: dockcheck.sh [OPTION] [part of name to filter]
|
||||
Syntax: dockcheck.sh [OPTION] [comma separated names to include]
|
||||
Example: dockcheck.sh -y -x 10 -d 10 -e nextcloud,heimdall
|
||||
|
||||
Options:
|
||||
@@ -145,6 +137,7 @@ Make certain your project directory is laid out as below. You only need the noti
|
||||
│ ├── notify_discord.sh
|
||||
│ ├── notify_generic.sh
|
||||
│ ├── notify_gotify.sh
|
||||
│ ├── notify_HA.sh
|
||||
│ ├── notify_matrix.sh
|
||||
│ ├── notify_ntfy.sh
|
||||
│ ├── notify_pushbullet.sh
|
||||
@@ -188,6 +181,7 @@ If an update becomes available for an item that is not snoozed, notifications wi
|
||||
- Read the [QuickStart](extras/apprise_quickstart.md)
|
||||
- [ntfy](https://ntfy.sh/) - HTTP-based pub-sub notifications.
|
||||
- [Gotify](https://gotify.net/) - a simple server for sending and receiving messages.
|
||||
- [Home Assistant](https://www.home-assistant.io/integrations/notify/) - Connection to the notify [integrations](https://www.home-assistant.io/integrations/#notifications).
|
||||
- [Pushbullet](https://www.pushbullet.com/) - connecting different devices with cross-platform features.
|
||||
- [Telegram](https://telegram.org/) - Telegram chat API.
|
||||
- [Matrix-Synapse](https://github.com/element-hq/synapse) - [Matrix](https://matrix.org/), open, secure, decentralised communication.
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
## All commented values are examples only. Modify as needed.
|
||||
##
|
||||
## Uncomment the line below and specify the notification channels you wish to enable in a space separated string
|
||||
# NOTIFY_CHANNELS="apprise discord DSM generic gotify matrix ntfy pushbullet pushover slack smtp telegram"
|
||||
# NOTIFY_CHANNELS="apprise discord DSM generic HA gotify matrix ntfy pushbullet pushover slack smtp telegram"
|
||||
#
|
||||
## Uncomment the line below and specify the number of seconds to delay notifications to enable snooze
|
||||
# SNOOZE_SECONDS=86400
|
||||
@@ -57,12 +57,16 @@
|
||||
# GOTIFY_DOMAIN="https://gotify.domain.tld"
|
||||
# GOTIFY_TOKEN="token-value"
|
||||
#
|
||||
# HA_ENTITY="entity"
|
||||
# HA_TOKEN="token"
|
||||
# HA_URL="https://your.homeassistant.url"
|
||||
#
|
||||
# MATRIX_ACCESS_TOKEN="token-value"
|
||||
# MATRIX_ROOM_ID="myroom"
|
||||
# MATRIX_SERVER_URL="https://matrix.yourdomain.tld"
|
||||
#
|
||||
## ntfy.sh or your custom domain with no trailing /
|
||||
# NTFY_DOMAIN="ntfy.sh"
|
||||
## https://ntfy.sh or your custom domain with https:// and no trailing /
|
||||
# NTFY_DOMAIN="https://ntfy.sh"
|
||||
# NTFY_TOPIC_NAME="YourUniqueTopicName"
|
||||
#
|
||||
# PUSHBULLET_URL="https://api.pushbullet.com/v2/pushes"
|
||||
@@ -82,3 +86,4 @@
|
||||
# TELEGRAM_CHAT_ID="mychatid"
|
||||
# TELEGRAM_TOKEN="token-value"
|
||||
# TELEGRAM_TOPIC_ID="0"
|
||||
|
||||
|
||||
17
dockcheck.sh
17
dockcheck.sh
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
VERSION="v0.6.8"
|
||||
# ChangeNotes: bugfix unbound variable in notify_v2, new option "DisplaySourcedFiles" added to config
|
||||
VERSION="v0.6.9"
|
||||
# ChangeNotes: bugfix label logic and added comma separated search filtering
|
||||
Github="https://github.com/mag37/dockcheck"
|
||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||
|
||||
@@ -29,7 +29,7 @@ source_if_exists_or_fail "${HOME}/.config/dockcheck.config" || source_if_exists_
|
||||
|
||||
# Help Function
|
||||
Help() {
|
||||
echo "Syntax: dockcheck.sh [OPTION] [part of name to filter]"
|
||||
echo "Syntax: dockcheck.sh [OPTION] [comma separated names to include]"
|
||||
echo "Example: dockcheck.sh -y -x 10 -d 10 -e nextcloud,heimdall"
|
||||
echo
|
||||
echo "Options:"
|
||||
@@ -121,8 +121,11 @@ while getopts "ayfFhiIlmMnprsuvc:e:d:t:x:" options; do
|
||||
done
|
||||
shift "$((OPTIND-1))"
|
||||
|
||||
# Set $1 to a variable for name filtering later
|
||||
# Set $1 to a variable for name filtering later, rewriting if multiple
|
||||
SearchName="${1:-}"
|
||||
if [[ ! -z "$SearchName" ]]; then
|
||||
SearchName="^(${SearchName//,/|})$"
|
||||
fi
|
||||
|
||||
# Check if there's a new release of the script
|
||||
LatestSnippet="$(curl ${CurlArgs} -r 0-200 "$RawUrl" || printf "undefined")"
|
||||
@@ -570,8 +573,11 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
||||
ContOnlySpecific=$($jqbin -r '."mag37.dockcheck.only-specific-container"' <<< "$ContLabels")
|
||||
[[ "$ContOnlySpecific" == "null" ]] && ContRestartStack=""
|
||||
|
||||
printf "\n%bNow recreating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset"
|
||||
# Checking if compose-values are empty - hence started with docker run
|
||||
[[ -z "$ContPath" ]] && continue
|
||||
[[ -z "$ContPath" ]] && { echo "Not a compose container, skipping."; continue; }
|
||||
# Checking if Label Only -option is set, and if container got the label
|
||||
[[ "$OnlyLabel" == true ]] && { [[ "$ContUpdateLabel" != true ]] && { echo "No update label, skipping."; continue; } }
|
||||
|
||||
# cd to the compose-file directory to account for people who use relative volumes
|
||||
cd "$ContPath" || { printf "\n%bPath error - skipping%b %s" "$c_red" "$c_reset" "$i"; continue; }
|
||||
@@ -587,7 +593,6 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
||||
# Set variable when compose up should only target the specific container, not the stack
|
||||
if [[ $OnlySpecific == true ]] || [[ $ContOnlySpecific == true ]]; then SpecificContainer="$ContName"; fi
|
||||
|
||||
printf "\n%bNow recreating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset"
|
||||
# Check if the whole stack should be restarted
|
||||
if [[ "$ContRestartStack" == true ]] || [[ "$ForceRestartStacks" == true ]]; then
|
||||
${DockerBin} ${CompleteConfs} stop; ${DockerBin} ${CompleteConfs} ${ContEnvs} up -d || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; }
|
||||
|
||||
BIN
extras/dockcheck_colour.png
Normal file
BIN
extras/dockcheck_colour.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 144 KiB |
31
notify_templates/notify_HA.sh
Executable file
31
notify_templates/notify_HA.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
NOTIFY_HA_VERSION="v0.1"
|
||||
#
|
||||
# This is an integration that makes it possible to send notifications via Home Assistant (https://www.home-assistant.io/integrations/notify/)
|
||||
# You need to generate a long-lived access token in Home Sssistant to be used here (https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token)
|
||||
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
|
||||
# Do not modify this file directly within the "notify_templates" subdirectory. Set HA_ENTITY, HA_URL and HA_TOKEN in your dockcheck.config file.
|
||||
|
||||
if [[ -z "${HA_ENTITY:-}" ]] || [[ -z "${HA_URL:-}" ]] || [[ -z "${HA_TOKEN:-}" ]]; then
|
||||
printf "Home Assistant notification channel enabled, but required configuration variables are missing. Home assistant notifications will not be sent.\n"
|
||||
|
||||
remove_channel HA
|
||||
fi
|
||||
|
||||
trigger_HA_notification() {
|
||||
AccessToken="${HA_TOKEN}"
|
||||
Url="${HA_URL}/api/services/notify/${HA_ENTITY}"
|
||||
JsonData=$( "$jqbin" -n \
|
||||
--arg body "$MessageBody" \
|
||||
'{"title": "dockcheck update", "message": $body}' )
|
||||
|
||||
curl -S -o /dev/null ${CurlArgs} \
|
||||
-H "Authorization: Bearer $AccessToken" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$JsonData" -X POST $Url
|
||||
|
||||
if [[ $? -gt 0 ]]; then
|
||||
NotifyError=true
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user