mirror of
https://github.com/mag37/dockcheck.git
synced 2026-04-17 18:07:46 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3eb8bb21db | ||
|
|
32f3dfbb2c | ||
|
|
d46b38ddad | ||
|
|
9245718eda | ||
|
|
4505cbac63 | ||
|
|
5bf81ce26e | ||
|
|
5cef6c20ff | ||
|
|
7785e869d3 |
16
README.md
16
README.md
@@ -23,6 +23,14 @@ ___
|
||||
|
||||
## 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**:
|
||||
- New:
|
||||
- Added Bark notify-template.
|
||||
@@ -76,7 +84,7 @@ Options:
|
||||
-p Auto-Prune dangling images after update.
|
||||
-r Allow checking/updating images created by `docker run`, containers need to be recreated manually.
|
||||
-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.
|
||||
-u Allow automatic self updates - caution as this will pull new code and autorun it.
|
||||
-v Prints current version.
|
||||
@@ -99,7 +107,7 @@ Containers with updates available:
|
||||
03) whoogle-search
|
||||
|
||||
Choose what containers to update:
|
||||
Enter number(s) separated by comma, [a] for all - [q] to quit: 1,2
|
||||
Enter number(s) or range(s) separated by comma (e.g. 1-2,4-5,09), [a] for all - [q] to quit: 1-2
|
||||
```
|
||||
|
||||
Then it proceeds to run `pull` and `up -d` on every container with updates.
|
||||
@@ -175,7 +183,8 @@ you wish to enable, but there is no harm in having all of them present.
|
||||
│ ├── notify_slack.sh
|
||||
│ ├── notify_smtp.sh
|
||||
│ ├── notify_telegram.sh
|
||||
│ └── notify_v2.sh
|
||||
│ ├── notify_v2.sh
|
||||
│ └── notify_xmpp.sh
|
||||
├── dockcheck.config
|
||||
├── dockcheck.sh
|
||||
└── 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
|
||||
- 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.
|
||||
- [XMPP](https://xmpp.org/getting-started/) - XMPP chat notifications.
|
||||
|
||||
Further additions are welcome - suggestions or PRs!
|
||||
<sub><sup>Initiated and first contributed by [yoyoma2](https://github.com/yoyoma2).</sup></sub>
|
||||
|
||||
@@ -95,3 +95,7 @@
|
||||
# TELEGRAM_CHAT_ID="mychatid"
|
||||
# TELEGRAM_TOKEN="token-value"
|
||||
# TELEGRAM_TOPIC_ID="0"
|
||||
#
|
||||
# XMPP_SOURCE_JID="mybotaccount@mydomain.tld"
|
||||
# XMPP_SOURCE_PWD="password"
|
||||
# XMPP_DEST_JID="myusername@mydomain.tld"
|
||||
|
||||
58
dockcheck.sh
58
dockcheck.sh
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
VERSION="v0.7.6"
|
||||
# ChangeNotes: Bugfixes and sanitation. Cleanup of default.config - migrate settings manually (optional).
|
||||
VERSION="v0.7.7"
|
||||
# ChangeNotes: xmpp template added, ranges for selection possible, restart-stack and -s reworked.
|
||||
Github="https://github.com/mag37/dockcheck"
|
||||
RawUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/dockcheck.sh"
|
||||
|
||||
@@ -51,7 +51,7 @@ Help() {
|
||||
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 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 "-u Allow automatic self updates - caution as this will pull new code and autorun it."
|
||||
echo "-v Prints current version."
|
||||
@@ -229,7 +229,7 @@ self_update() {
|
||||
|
||||
choosecontainers() {
|
||||
while [[ -z "${ChoiceClean:-}" ]]; do
|
||||
read -r -p "Enter number(s) separated by comma, [a] for all - [q] to quit: " Choice
|
||||
read -r -p "Enter number(s) or range(s) separated by comma (e.g. 1-2,4-5,09), [a] for all - [q] to quit: " Choice
|
||||
if [[ "$Choice" =~ [qQnN] ]]; then
|
||||
[[ -n "${BackupForDays:-}" ]] && remove_backups
|
||||
exit 0
|
||||
@@ -238,12 +238,28 @@ choosecontainers() {
|
||||
ChoiceClean=${Choice//[,.:;]/ }
|
||||
else
|
||||
ChoiceClean=${Choice//[,.:;]/ }
|
||||
SelectedUpdates=()
|
||||
for CC in $ChoiceClean; do
|
||||
CC=$((10#$CC)) # Base 10 interpretation to strip leading zeroes
|
||||
if [[ "$CC" -lt 1 || "$CC" -gt $UpdCount ]]; then # Reset choice if out of bounds
|
||||
echo "Number not in list: $CC"; unset ChoiceClean; break 1
|
||||
if [[ "$CC" == *-* ]]; then
|
||||
if [[ "$CC" =~ ^([0-9]+)-([0-9]+)$ ]]; then
|
||||
# Enforce base 10 to avoid octal parsing of leading zeroes
|
||||
RangeStart=$((10#${BASH_REMATCH[1]}))
|
||||
RangeEnd=$((10#${BASH_REMATCH[2]}))
|
||||
if [[ "$RangeStart" -lt 1 || "$RangeEnd" -gt $UpdCount || "$RangeStart" -gt "$RangeEnd" ]]; then
|
||||
echo "Entered list is out of bounds: $CC"; unset ChoiceClean; break 1
|
||||
else
|
||||
for ((idx=RangeStart; idx<=RangeEnd; idx++)); do SelectedUpdates+=( "${GotUpdates[$idx-1]}" ); done
|
||||
fi
|
||||
else
|
||||
echo "Invalid range: $CC"; unset ChoiceClean; break 1
|
||||
fi
|
||||
else
|
||||
SelectedUpdates+=( "${GotUpdates[$CC-1]}" )
|
||||
CC=$((10#$CC)) # Base 10 interpretation to strip leading zeroes
|
||||
if [[ "$CC" -lt 1 || "$CC" -gt $UpdCount ]]; then # Reset choice if out of bounds
|
||||
echo "Number not in list: $CC"; unset ChoiceClean; break 1
|
||||
else
|
||||
SelectedUpdates+=( "${GotUpdates[$CC-1]}" )
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -380,7 +396,7 @@ dependency_check() {
|
||||
binary_downloader "$AppName" "$AppUrl"
|
||||
[[ -f "$ScriptWorkDir/$AppName" ]] && { export "$AppVar"="$ScriptWorkDir/$1" && printf "\n%b%s downloaded.%b\n" "$c_green" "$AppName" "$c_reset"; }
|
||||
fi
|
||||
else printf "\n%bDependency missing, exiting.%b\n" "$c_red" "$c_reset"; exit 1;
|
||||
else printf "\n%bDependency '%s' missing, exiting.%b\n" "$c_red" "$AppName" "$c_reset"; exit 1;
|
||||
fi
|
||||
fi
|
||||
# Final check if binary is correct
|
||||
@@ -634,6 +650,7 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
||||
for i in "${SelectedUpdates[@]}"; do
|
||||
((CurrentQue+=1))
|
||||
unset CompleteConfs
|
||||
ContStopAfter=false
|
||||
# Extract labels and metadata
|
||||
ContConfig=$(docker inspect "$i" --format '{{json .}}')
|
||||
ContLabels=$($jqbin -r '."Config"."Labels"' <<< "$ContConfig")
|
||||
@@ -648,15 +665,15 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
||||
ContRestartStack=$($jqbin -r '."mag37.dockcheck.restart-stack"' <<< "$ContLabels")
|
||||
[[ "$ContRestartStack" == "null" ]] && ContRestartStack=""
|
||||
ContOnlySpecific=$($jqbin -r '."mag37.dockcheck.only-specific-container"' <<< "$ContLabels")
|
||||
[[ "$ContOnlySpecific" == "null" ]] && ContRestartStack=""
|
||||
[[ "$ContOnlySpecific" == "null" ]] && ContOnlySpecific=""
|
||||
ContStateRunning=$($jqbin -r '."State"."Running"' <<< "$ContConfig")
|
||||
[[ "$ContStateRunning" == "null" ]] && ContStateRunning=""
|
||||
|
||||
if [[ "$ContStateRunning" == "true" ]]; then
|
||||
printf "\n%bNow recreating (%s/%s): %b%s%b\n" "$c_teal" "$CurrentQue" "$NumberofUpdates" "$c_blue" "$i" "$c_reset"
|
||||
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"
|
||||
continue
|
||||
ContStopAfter=true
|
||||
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
|
||||
|
||||
# Checking if compose-values are empty - hence started with docker run
|
||||
@@ -678,10 +695,15 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
||||
|
||||
# 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; }
|
||||
${DockerBin} ${CompleteConfs} down; ${DockerBin} ${CompleteConfs} ${ContEnvs} up -d || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; }
|
||||
else
|
||||
${DockerBin} ${CompleteConfs} ${ContEnvs} up -d ${SpecificContainer} || { printf "\n%bDocker error, exiting!%b\n" "$c_red" "$c_reset" ; exit 1; }
|
||||
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
|
||||
fi
|
||||
printf "\n%bAll updates done!%b\n" "$c_green" "$c_reset"
|
||||
@@ -689,7 +711,7 @@ if [[ -n "${GotUpdates:-}" ]]; then
|
||||
# Trigger pruning only when backup-function is not used
|
||||
if [[ -z "${BackupForDays:-}" ]]; then
|
||||
if [[ "$AutoPrune" == false ]] && [[ "$AutoMode" == false ]]; then printf "\n"; read -rep "Would you like to prune all dangling images? y/[n]: " AutoPrune; fi
|
||||
if [[ "$AutoPrune" == true ]] || [[ "$AutoPrune" =~ [yY] ]]; then printf "\nAuto pruning.."; docker image prune -f; fi
|
||||
if [[ "$AutoPrune" == true ]] || [[ "$AutoPrune" =~ [yY] ]]; then printf "\nAuto pruning.."; docker image prune -f && AlreadyPruned="true" ; fi
|
||||
fi
|
||||
|
||||
else
|
||||
@@ -699,7 +721,11 @@ else
|
||||
printf "\nNo updates available.\n"
|
||||
fi
|
||||
|
||||
# Clean up old backup image tags if -b is used
|
||||
[[ -n "${BackupForDays:-}" ]] && remove_backups
|
||||
# Clean up old backup image tags if -b is used otherwise prune if auto-prune is set
|
||||
if [[ -n "${BackupForDays:-}" ]]; then
|
||||
remove_backups
|
||||
else
|
||||
if [[ "$AutoPrune" == true ]] && [[ "${AlreadyPruned:=false}" != true ]]; then printf "\nAuto pruning.."; docker image prune -f; fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
47
notify_templates/notify_xmpp.sh
Normal file
47
notify_templates/notify_xmpp.sh
Normal 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
|
||||
|
||||
}
|
||||
@@ -3,33 +3,47 @@
|
||||
# This is a list of container names and releasenote urls, separated by space.
|
||||
|
||||
actual_server https://actualbudget.org/blog
|
||||
adguardhome https://github.com/AdguardTeam/AdGuardHome/releases
|
||||
apprise-api https://github.com/linuxserver/docker-apprise-api/releases
|
||||
audiobookshelf https://github.com/advplyr/audiobookshelf/releases
|
||||
authentik_server https://github.com/goauthentik/authentik/releases
|
||||
authentik_worker https://github.com/goauthentik/authentik/releases
|
||||
barassistant https://github.com/karlomikus/bar-assistant//releases
|
||||
barassistant_api https://github.com/karlomikus/bar-assistant/releases
|
||||
bazarr https://github.com/morpheus65535/bazarr/releases
|
||||
bazarr-ls https://github.com/linuxserver/docker-bazarr/releases
|
||||
beszel https://github.com/henrygd/beszel/releases
|
||||
booklore https://github.com/booklore-app/BookLore/releases
|
||||
bookstack https://github.com/BookStackApp/BookStack/releases
|
||||
bruceforce-vaultwarden-backup https://github.com/Bruceforce/vaultwarden-backup/blob/main/CHANGELOG.md
|
||||
caddy https://github.com/caddyserver/caddy/releases
|
||||
calibre https://github.com/linuxserver/docker-calibre/releases
|
||||
calibre-web https://github.com/linuxserver/docker-calibre-web/releases
|
||||
cleanuperr https://github.com/flmorg/cleanuperr/releases
|
||||
collabora https://github.com/CollaboraOnline/online/releases
|
||||
cross-seed https://github.com/cross-seed/cross-seed/releases
|
||||
crowdsec https://github.com/crowdsecurity/crowdsec/releases
|
||||
cup https://github.com/sergi0g/cup/releases
|
||||
databasus https://github.com/databasus/databasus/releases
|
||||
dockge https://github.com/louislam/dockge/releases
|
||||
dozzle https://github.com/amir20/dozzle/releases
|
||||
esphome https://github.com/esphome/esphome/releases
|
||||
feishin https://github.com/jeffvli/feishin/releases
|
||||
flatnotes https://github.com/dullage/flatnotes/releases
|
||||
forgejo https://codeberg.org/forgejo/forgejo/releases
|
||||
fressrss https://github.com/FreshRSS/FreshRSS/releases
|
||||
frigate https://github.com/blakeblackshear/frigate/releases
|
||||
gerbil https://github.com/fosrl/gerbil/releases
|
||||
glances https://github.com/nicolargo/glances/releases
|
||||
gluetun https://github.com/qdm12/gluetun/releases
|
||||
go2rtc https://github.com/AlexxIT/go2rtc/releases
|
||||
godoxy https://github.com/yusing/godoxy/releases
|
||||
gotify https://github.com/gotify/server/releases
|
||||
hbbr https://github.com/rustdesk/rustdesk-server/releases
|
||||
hbbs https://github.com/rustdesk/rustdesk-server/releases
|
||||
homarr https://github.com/homarr-labs/homarr/releases
|
||||
home-assistant https://github.com/home-assistant/core/releases/
|
||||
homepage https://github.com/gethomepage/homepage/releases
|
||||
homer https://github.com/bastienwirtz/homer/releases
|
||||
immich_machine_learning https://github.com/immich-app/immich/releases
|
||||
immich_postgres https://github.com/tensorchord/VectorChord/releases
|
||||
@@ -38,6 +52,7 @@ immich_server https://github.com/immich-app/immich/releases
|
||||
jellyfin https://github.com/jellyfin/jellyfin/releases
|
||||
jellyseerr https://github.com/Fallenbagel/jellyseerr/releases
|
||||
jellystat https://github.com/CyferShepard/Jellystat/releases
|
||||
karakeep https://github.com/karakeep-app/karakeep/releases
|
||||
librespeed https://github.com/librespeed/speedtest/releases
|
||||
lidarr https://github.com/Lidarr/Lidarr/releases/
|
||||
lidarr-ls https://github.com/linuxserver/docker-lidarr/releases
|
||||
@@ -47,9 +62,12 @@ mealie https://github.com/mealie-recipes/mealie/releases
|
||||
meilisearch https://github.com/meilisearch/meilisearch/releases
|
||||
monica https://github.com/monicahq/monica/releases
|
||||
mqtt https://github.com/eclipse/mosquitto/tags
|
||||
navidrome https://github.com/navidrome/navidrome/releases
|
||||
newt https://github.com/fosrl/newt/releases
|
||||
nextcloud-aio-mastercontainer https://github.com/nextcloud/all-in-one/releases
|
||||
nginx https://github.com/docker-library/official-images/blob/master/library/nginx
|
||||
opencloud https://github.com/opencloud-eu/opencloud/releases
|
||||
outline https://github.com/outline/outline/releases
|
||||
owncast https://github.com/owncast/owncast/releases
|
||||
pangolin https://github.com/fosrl/pangolin/releases
|
||||
prowlarr https://github.com/Prowlarr/Prowlarr/releases
|
||||
@@ -63,18 +81,25 @@ readeck https://codeberg.org/readeck/readeck/releases
|
||||
recyclarr https://github.com/recyclarr/recyclarr/releases
|
||||
roundcubemail https://github.com/roundcube/roundcubemail/releases
|
||||
sabnzbd https://github.com/linuxserver/docker-sabnzbd/releases
|
||||
scanopy https://github.com/scanopy/scanopy/releases
|
||||
scrutiny https://github.com/AnalogJ/scrutiny/releases
|
||||
sftpgo https://github.com/drakkan/sftpgo/releases
|
||||
slskd https://github.com/slskd/slskd/releases
|
||||
snappymail https://github.com/the-djmaze/snappymail/releases
|
||||
stirling-pdf https://github.com/Stirling-Tools/Stirling-PDF/releases
|
||||
sonarr https://github.com/Sonarr/Sonarr/releases/
|
||||
sonarr-ls https://github.com/linuxserver/docker-sonarr/releases
|
||||
synapse https://github.com/element-hq/synapse/releases
|
||||
syncthing https://github.com/syncthing/syncthing/releases
|
||||
tailscale https://github.com/tailscale/tailscale/releases
|
||||
tautulli https://github.com/Tautulli/Tautulli/releases
|
||||
thelounge https://github.com/thelounge/thelounge/releases
|
||||
traefik https://github.com/traefik/traefik/releases
|
||||
uptime-kuma https://github.com/louislam/uptime-kuma/releases
|
||||
vaultwarden-server https://github.com/dani-garcia/vaultwarden/releases
|
||||
vikunja https://github.com/go-vikunja/vikunja/releases
|
||||
wallos https://github.com/ellite/Wallos/releases
|
||||
watchtower https://github.com/beatkind/watchtower/releases
|
||||
wopiserver https://github.com/cs3org/wopiserver/releases
|
||||
wud https://github.com/getwud/wud/releases
|
||||
zigbee2mqtt https://github.com/Koenkk/zigbee2mqtt/releases
|
||||
|
||||
Reference in New Issue
Block a user