Compare commits

...

3 Commits

Author SHA1 Message Date
mag37
3eb8bb21db versionbump 2026-03-12 12:17:15 +01:00
Philip Baylas
32f3dfbb2c When -s flag is used, start stopped containers so they are updated and then stop them again (#269)
* Start stopped containers (when -s is used) so that updates apply
* Automatically re-stop stopped containers after updating
2026-03-11 16:50:38 +01:00
jHund
d46b38ddad Support for notifications via XMPP (#268)
* Add files via upload

Added support for XMPP using go-sendxmpp.

* Add files via upload

Added support for XMPP using go-sendxmpp.
2026-03-05 19:27:54 +01:00
4 changed files with 74 additions and 7 deletions

View File

@@ -23,6 +23,14 @@ ___
## Changelog ## Changelog
- **v0.7.7**:
- New:
- More URLs to urls.list.
- Allowing ranges to be used when selecting containers to update.
- Added XMPP notification template.
- Fixes:
- Changed "restart-stack" behavior to down+up instead of stop+up.
- `-s` option now recreates stopped containers and then stops them again.
- **v0.7.6**: - **v0.7.6**:
- New: - New:
- Added Bark notify-template. - Added Bark notify-template.
@@ -76,7 +84,7 @@ Options:
-p Auto-Prune dangling images after update. -p Auto-Prune dangling images after update.
-r Allow checking/updating images created by `docker run`, containers need to be recreated manually. -r Allow checking/updating images created by `docker run`, containers need to be recreated manually.
-R Skip container recreation after pulling images. -R Skip container recreation after pulling images.
-s Include stopped containers in the check. (Logic: docker ps -a). -s Include stopped containers, returns to stopped state after recreation.
-t N Set a timeout (in seconds) per container for registry checkups, 10 is default. -t N Set a timeout (in seconds) per container for registry checkups, 10 is default.
-u Allow automatic self updates - caution as this will pull new code and autorun it. -u Allow automatic self updates - caution as this will pull new code and autorun it.
-v Prints current version. -v Prints current version.
@@ -175,7 +183,8 @@ you wish to enable, but there is no harm in having all of them present.
│ ├── notify_slack.sh │ ├── notify_slack.sh
│ ├── notify_smtp.sh │ ├── notify_smtp.sh
│ ├── notify_telegram.sh │ ├── notify_telegram.sh
── notify_v2.sh ── notify_v2.sh
│ └── notify_xmpp.sh
├── dockcheck.config ├── dockcheck.config
├── dockcheck.sh ├── dockcheck.sh
└── urls.list # optional └── urls.list # optional
@@ -219,6 +228,7 @@ The actual snooze duration will be 60 seconds less than `SNOOZE_SECONDS` to acco
- [Slack](https://api.slack.com/tutorials/tracks/posting-messages-with-curl) - Slack curl api - [Slack](https://api.slack.com/tutorials/tracks/posting-messages-with-curl) - Slack curl api
- SMTP Email with [mSMTP](https://wiki.debian.org/msmtp) (or deprecated alternative [sSMTP](https://wiki.debian.org/sSMTP)) - SMTP Email with [mSMTP](https://wiki.debian.org/msmtp) (or deprecated alternative [sSMTP](https://wiki.debian.org/sSMTP))
- [Telegram](https://telegram.org/) - Telegram chat API. - [Telegram](https://telegram.org/) - Telegram chat API.
- [XMPP](https://xmpp.org/getting-started/) - XMPP chat notifications.
Further additions are welcome - suggestions or PRs! Further additions are welcome - suggestions or PRs!
<sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub> <sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub>

View File

@@ -95,3 +95,7 @@
# TELEGRAM_CHAT_ID="mychatid" # TELEGRAM_CHAT_ID="mychatid"
# TELEGRAM_TOKEN="token-value" # TELEGRAM_TOKEN="token-value"
# TELEGRAM_TOPIC_ID="0" # TELEGRAM_TOPIC_ID="0"
#
# XMPP_SOURCE_JID="mybotaccount@mydomain.tld"
# XMPP_SOURCE_PWD="password"
# XMPP_DEST_JID="myusername@mydomain.tld"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION="v0.7.6" VERSION="v0.7.7"
# ChangeNotes: Bugfixes and sanitation. Cleanup of default.config - migrate settings manually (optional). # ChangeNotes: xmpp template added, ranges for selection possible, restart-stack and -s reworked.
Github="https://github.com/mag37/dockcheck" Github="https://github.com/mag37/dockcheck"
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh" RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
@@ -51,7 +51,7 @@ Help() {
echo "-p Auto-prune dangling images after update." echo "-p Auto-prune dangling images after update."
echo "-r Allow checking/updating images created by 'docker run', containers need to be recreated manually." echo "-r Allow checking/updating images created by 'docker run', containers need to be recreated manually."
echo "-R Skip container recreation after pulling images." echo "-R Skip container recreation after pulling images."
echo "-s Include stopped containers in the check. (Logic: docker ps -a)." echo "-s Include stopped containers, returns to stopped state after recreation."
echo "-t N Set a timeout (in seconds) per container for registry checkups, 10 is default." echo "-t N Set a timeout (in seconds) per container for registry checkups, 10 is default."
echo "-u Allow automatic self updates - caution as this will pull new code and autorun it." echo "-u Allow automatic self updates - caution as this will pull new code and autorun it."
echo "-v Prints current version." echo "-v Prints current version."
@@ -650,6 +650,7 @@ if [[ -n "${GotUpdates:-}" ]]; then
for i in "${SelectedUpdates[@]}"; do for i in "${SelectedUpdates[@]}"; do
((CurrentQue+=1)) ((CurrentQue+=1))
unset CompleteConfs unset CompleteConfs
ContStopAfter=false
# Extract labels and metadata # Extract labels and metadata
ContConfig=$(docker inspect "$i" --format '{{json .}}') ContConfig=$(docker inspect "$i" --format '{{json .}}')
ContLabels=$($jqbin -r '."Config"."Labels"' <<< "$ContConfig") ContLabels=$($jqbin -r '."Config"."Labels"' <<< "$ContConfig")
@@ -671,8 +672,8 @@ if [[ -n "${GotUpdates:-}" ]]; then
if [[ "$ContStateRunning" == "true" ]]; then if [[ "$ContStateRunning" == "true" ]]; then
printf "\n%bNow recreating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset" printf "\n%bNow recreating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset"
else else
printf "\n%bSkipping recreation of %b%s%b as it's not running.%b\n" "$c_yellow" "$c_blue" "$i" "$c_yellow" "$c_reset" ContStopAfter=true
continue printf "\n%bRecreating %b%s%b to apply update - then stopping to return to current state.%b\n" "$c_yellow" "$c_blue" "$i" "$c_yellow" "$c_reset"
fi fi
# Checking if compose-values are empty - hence started with docker run # Checking if compose-values are empty - hence started with docker run
@@ -698,6 +699,11 @@ if [[ -n "${GotUpdates:-}" ]]; then
else else
${DockerBin} ${CompleteConfs} ${ContEnvs} up -d ${SpecificContainer} || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; } ${DockerBin} ${CompleteConfs} ${ContEnvs} up -d ${SpecificContainer} || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; }
fi fi
# Restore the stopped state of updated cotainers
if [[ "$ContStopAfter" == true ]]; then
${DockerBin} ${CompleteConfs} stop ${SpecificContainer} || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; }
fi
done done
fi fi
printf "\n%bAll updates done!%b\n" "$c_green" "$c_reset" printf "\n%bAll updates done!%b\n" "$c_green" "$c_reset"

View File

@@ -0,0 +1,47 @@
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
NOTIFY_XMPP_VERSION="v0.1"
#
# Requires the package "go-sendxmpp" to be installed and in $PATH.
#
# 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 XMPP_SOURCE_ID, XMPP_SOURCE_PWD and XMPP_DEST_JID in your dockcheck.config file.
trigger_xmpp_notification() {
if [[ -n "$1" ]]; then
xmpp_channel="$1"
else
xmpp_channel="xmpp"
fi
if ! command -v go-sendxmpp &>/dev/null; then
printf "\nRequired binary go-sendxmpp missing. XMPP notification will not be sent.\n"
remove_channel xmpp
return 0
fi
UpperChannel="${xmpp_channel^^}"
SourceJidVar="${UpperChannel}_SOURCE_JID"
SourcePwdVar="${UpperChannel}_SOURCE_PWD"
DestJidVar="${UpperChannel}_DEST_JID"
if [[ -z "${!SourceJidVar:-}" ]] || [[ -z "${!DestJidVar:-}" ]] || [[ -z "${!SourcePwdVar:-}" ]]; then
printf "\nRequired configuration variables are missing. XMPP notifications will not be sent.\n"
remove_channel xmpp
return 0
fi
SourceJid="${!SourceJidVar}" # E.g `mybotaccount@mydomain.tld`
SourcePwd="${!SourcePwdVar}" # The password for the account `mybotaccount@mydomain.tld`
DestJid="${!DestJidVar}" # E.g `myusername@mydomain.tld`
echo "$MessageBody" | go-sendxmpp --suppress-root-warning -u "$SourceJid" -p "$SourcePwd" "$DestJid"
if [[ $? -gt 0 ]]; then
NotifyError=true
fi
}