Mise a jour automatique programmee (crontab) par stack
- planification crontab par stack (autoupdate.json), incompatible avec l'exclusion
- scheduler a la minute ; pull puis down + up -d seulement si une image a change (mode autoapply)
- API PUT .../targets/{t}/auto et GET /api/cron (apercu des prochaines executions)
- interface : option dans le detail, badge sarcelle, vue de suivi "Mises a jour auto"
- TZ dans docker-compose / .env.example (tzdata embarque)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LNfwm6UCYFyvNQNSF5i9Gy
This commit is contained in:
1 parent
54cbab17cb
commit
51691d7b8a
16 files changed
+1010
-7
No files matched your search
@@ -97,6 +97,27 @@ apply)
|
||||
printf 'A\tok\tstack relancée (down + up -d)\n'
|
||||
;;
|
||||
|
||||
autoapply)
|
||||
# Mise a jour programmee : pull, puis down + up -d seulement si une image a change.
|
||||
dir=$1
|
||||
[ -d "$dir" ] && compose_file "$dir" >/dev/null || { printf 'A\tfail\t%s\n' "aucune stack dans $dir"; exit 0; }
|
||||
cd "$dir" || { printf 'A\tfail\t%s\n' "repertoire inaccessible"; exit 0; }
|
||||
ids=$(docker compose ps -q 2>/dev/null </dev/null)
|
||||
[ -n "$ids" ] || { printf 'A\tskip\t%s\n' "stack arretee : rien a faire"; exit 0; }
|
||||
out=$(with_timeout 900 docker compose pull --ignore-buildable 2>&1 </dev/null) || { printf 'A\tfail\tpull : %s\n' "$(printf '%s' "$out" | flat)"; exit 0; }
|
||||
changed=0
|
||||
for cid in $ids; do
|
||||
info=$(docker inspect -f '{{.Image}}|{{.Config.Image}}' "$cid" 2>/dev/null </dev/null) || continue
|
||||
running=${info%%|*}; image=${info#*|}
|
||||
latest=$(docker image inspect -f '{{.Id}}' "$image" 2>/dev/null </dev/null) || continue
|
||||
[ "$running" = "$latest" ] || changed=1
|
||||
done
|
||||
[ "$changed" = 1 ] || { printf 'A\tskip\t%s\n' "deja a jour : aucune nouvelle image"; exit 0; }
|
||||
out=$(docker compose down 2>&1 </dev/null) || { printf 'A\tfail\tdown : %s\n' "$(printf '%s' "$out" | flat)"; exit 0; }
|
||||
out=$(docker compose up -d 2>&1 </dev/null) || { printf 'A\tfail\tup -d : %s\n' "$(printf '%s' "$out" | flat)"; exit 0; }
|
||||
printf 'A\tok\tnouvelle image : stack relancee (down + up -d)\n'
|
||||
;;
|
||||
|
||||
*)
|
||||
printf 'E\t-\tmode inconnu\n'
|
||||
;;
|
||||
|
||||
Reference in new issue
Block a user