Stackwatch : suivi des mises à jour de stacks docker compose via SSH

Base Up And Down (auth, thème, dialogues) + moteur fleet (script distant POSIX,
analyse pull + comparaison d'images, mise à jour d'une stack), interface de suivi.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
claude BotandClaude Sonnet 5.5 committed 2026-11-23 08:37:40 +01:00
commit 56e1bbe842
54 files changed
+10954

No files matched your search

Executable
+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
# Démo locale sans serveur réel : un faux `ssh` exécute le script distant en local,
# un faux `docker` simule des stacks (à jour, en retard, arrêtée, en erreur...).
# Usage : demo/demo.sh [port] (binaire : bin/stackwatch, voir README)
set -e
cd "$(dirname "$0")/.."
PORT=${1:-8099}
DEMO=$PWD/demo/.state
mkdir -p "$DEMO/data"
if [ ! -d "$DEMO/home" ]; then
for d in nextcloud outdated traefik alice/blog stopped badpull broken; do
mkdir -p "$DEMO/home/$d"; echo "services: {}" > "$DEMO/home/$d/compose.yaml"
done
fi
export PATH="$PWD/demo/fake-bin:$PATH" AUTH_MODE=none DATA_DIR="$DEMO/data" LISTEN_ADDR=127.0.0.1:$PORT CHECK_INTERVAL=0
# Serveur de démonstration pré-enregistré au premier lancement.
mkdir -p "$DEMO/data/fleet"
if [ ! -f "$DEMO/data/fleet/servers.json" ]; then
cat > "$DEMO/data/fleet/servers.json" <<JSON
[
{"id":"demo1","name":"lancelot","host":"lancelot.example.org","port":22,"note":"stacks de production","enabled":true,
"targets":[{"id":"t1","user":"root","roots":["$DEMO/home"],"depth":1},
{"id":"t2","user":"alice","roots":["$DEMO/home/alice"],"depth":1}]},
{"id":"demo2","name":"arthur","host":"arthur.example.org","port":2222,"enabled":true,
"targets":[{"id":"t3","user":"deploy","roots":["$DEMO/home/alice"],"depth":1}]}
]
JSON
fi
exec ./bin/stackwatch
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
d=$(basename "$PWD")
case "$1 $2" in
"version -f") echo 27.0.0; exit 0 ;;
"compose version") if [ "$3" = "--short" ]; then echo 2.29.0; else echo "Docker Compose version v2.29.0"; fi; exit 0 ;;
"compose config")
[ "$d" = empty ] && { echo "empty compose file" >&2; exit 1; }
[ "$d" = broken ] && { echo "yaml: line 3: mapping values are not allowed" >&2; exit 1; }
exit 0 ;;
"compose ps") [ "$d" = stopped ] && exit 0; echo c1; [ "$d" = outdated ] && echo c2; exit 0 ;;
"compose pull") [ "$d" = badpull ] && { echo "pull access denied" >&2; exit 1; }; exit 0 ;;
"compose down"|"compose up") exit 0 ;;
"inspect -f")
case "$4" in
c1) echo "sha256:aaaaaaaaaaaaaaaaaaaa|nginx:latest|web" ;;
c2) echo "sha256:bbbbbbbbbbbbbbbbbbbb|redis:7|cache" ;;
esac; exit 0 ;;
"image inspect")
case "$5" in
nginx:latest) [ "$d" = outdated ] && echo sha256:aaaaaaaaaaaaaaaaaaaa || echo sha256:aaaaaaaaaaaaaaaaaaaa ;;
redis:7) echo sha256:cccccccccccccccccccc ;;
esac; exit 0 ;;
esac
exit 1
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
# faux ssh : exécute la commande distante (dernier argument) en local
for a; do last=$a; done
sleep 0.6
exec sh -c "$last"
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Premier envoi vers Gitea (à lancer une fois depuis la racine du dépôt).
set -e
cd "$(dirname "$0")/.."
rm -rf .git
git init -q -b main
git add -A
git -c user.name="Cédric" -c user.email="claude@killy.net" commit -q -m "Stackwatch : suivi des mises à jour de stacks docker compose via SSH
Base Up And Down (auth, thème, dialogues) + moteur fleet (script distant POSIX,
analyse pull + comparaison d'images, mise à jour d'une stack), interface de suivi.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>"
git remote add origin git@gitea.vlab.bzh:vLab-BZH/stackwatch.git
git push -u origin main
git log --oneline | head -3