diff --git a/AGENT_devops.md b/AGENT_devops.md index f138491..b9f4c8c 100755 --- a/AGENT_devops.md +++ b/AGENT_devops.md @@ -1,263 +1,278 @@ -# AGENTS.md - Instructions pour Mistral Vibe et autres agents - -## 🎯 Workflow DevOps Homelab - -### ✅ RÈGLES FONDAMENTALES - -1. **TOUJOURS travailler depuis le dĂ©pĂŽt Git** - - DĂ©pĂŽt principal : https://git.peis.fr/VisualPCI/homelab-config - - Clone local : `~/homelab-config` (WSL) - - **JAMAIS** modifier les fichiers locaux sur `C:\Users\theo\.vibe\Proxmox\inventair\` - -2. **Avant TOUTE action** : - ```bash - cd ~/homelab-config - GIT_SSL_NO_VERIFY=true git pull origin main - ``` - -3. **AprĂšs TOUTE modification** : - ```bash - git add . - git commit -m "description claire de la modification" - GIT_SSL_NO_VERIFY=true git push origin main - ``` - -4. **Authentification Git** : - - URL : `https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git` - - Utilisateur : VisualPCI - - Mot de passe : 3N14E7GWVSgi3K - ---- - -## 📁 Structure du dĂ©pĂŽt - -``` -homelab-config/ -├── AGENTS.md ← Ce fichier -├── INSTRUCTIONS.md ← Instructions gĂ©nĂ©rales -├── homelab-inventaire.md ← Inventaire principal -├── status-monitor/ ← Service de monitoring -│ ├── app.py ← Code principal (corrigĂ©) -│ ├── app_v1.py ← Backup ancienne version -│ ├── app_v2.py ← Backup ancienne version -│ ├── deploy.sh ← Script de dĂ©ploiement -│ └── dynamic_traefik.yml ← Configuration Traefik -├── traefik-config/ ← Configurations Traefik -└── procedure-*.md ← Documentations -``` - ---- - -## 🚀 DĂ©ploiement Status Monitor (CT201) - -### Serveur cible -- **IP** : 192.168.0.201 -- **Service** : `status-monitor` (systemd) -- **Dossier** : `/opt/status-monitor/` -- **URL** : https://status.peis.fr - -### Workflow de dĂ©ploiement - -#### 1. Modifier le code -```bash -cd ~/homelab-config -# Modifier les fichiers dans status-monitor/ -git add status-monitor/ -git commit -m "Fix: description de la correction" -git push origin main -``` - -#### 2. DĂ©ployer sur CT201 -**Option A - DĂ©ploiement automatique :** -```bash -wsl bash ~/homelab-config/status-monitor/deploy.sh -``` - -**Option B - DĂ©ploiement manuel :** -```bash -# Copier les fichiers -scp ~/homelab-config/status-monitor/app.py root@192.168.0.201:/opt/status-monitor/ -scp ~/homelab-config/status-monitor/deploy.sh root@192.168.0.201:/opt/status-monitor/ - -# RedĂ©marrer le service -ssh root@192.168.0.201 "chmod +x /opt/status-monitor/deploy.sh" -ssh root@192.168.0.201 "systemctl restart status-monitor" -``` - -#### 3. VĂ©rifier le dĂ©ploiement -```bash -# VĂ©rifier l'API -curl -k -s https://status.peis.fr/api/status | python3 -m json.tool - -# Ou via navigateur -https://status.peis.fr -``` - ---- - -## 🐞 Corrections courantes - -### ProblĂšme : Cache non rafraĂźchi -**SymptĂŽme** : La page status affiche des donnĂ©es anciennes - -**Cause** : `status_cache` n'Ă©tait pas rafraĂźchi aprĂšs le premier chargement - -**Solution appliquĂ©e** : -```python -# AVANT (bug) : -if not status_cache: - check_all() - -# APRÈS (corrigĂ©) : -check_all() # Toujours rafraĂźchir Ă  chaque appel -``` - -**Fichier** : `status-monitor/app.py` (ligne 372) - ---- - -## 📋 Commandes utiles - -### Git -```bash -# État -cd ~/homelab-config && git status - -# Pull -cd ~/homelab-config && git pull - -# Commit -cd ~/homelab-config && git add . && git commit -m "message" && git push - -# Voir l'historique -cd ~/homelab-config && git log --oneline --graph -``` - -### SSH CT201 (via rebond CT200) -```bash -# Se connecter (CT200 est le bastion) -ssh -J root@192.168.0.100 root@192.168.0.201 - -# Voir les logs du service -ssh -J root@192.168.0.100 root@192.168.0.201 "journalctl -u status-monitor -f" - -# État du service -ssh -J root@192.168.0.100 root@192.168.0.201 "systemctl status status-monitor" - -# RedĂ©marrer -ssh -J root@192.168.0.100 root@192.168.0.201 "systemctl restart status-monitor" -``` - -### SSH CT200 (direct) -```bash -# Se connecter directement -ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 - -# Copier des fichiers vers CT200 -scp -i ~/.ssh/id_ed25519 fichier root@192.168.0.100:/destination/ - -# Copier des fichiers de CT200 vers local -scp -i ~/.ssh/id_ed25519 root@192.168.0.100:/source/fichier ./ -``` - -### Gitea -- **URL** : https://git.peis.fr -- **Compte** : VisualPCI -- **DĂ©pĂŽt** : https://git.peis.fr/VisualPCI/homelab-config - -### Workflow complet utilisĂ© pour la correction du 20/07/2026 - -**ProblĂšme** : SyntaxError: Unexpected identifier 'card' (at index.html:101:35) -**Cause** : Dans `status-monitor/app.py`, les strings JavaScript utilisaient `class=\"` qui gĂ©nĂ©rait du code JS invalide. - -**Workflow appliquĂ©** : -```bash -# 1. Cloner depuis WSL (Ubuntu) -cd ~/homelab-config -git clone https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git - -# 2. RĂ©cupĂ©rer le fichier buggĂ© depuis CT201 (via CT200) -ssh -J root@192.168.0.100 root@192.168.0.201 cat /opt/status-monitor/app.py > status-monitor/app_from_ct201.py - -# 3. Corriger le bug avec Python (remplacer \" par ') -python3 -c " -with open('status-monitor/app.py', 'r') as f: - content = f.read() -content = content.replace('\\\"', \"'\") -with open('status-monitor/app.py', 'w') as f: - f.write(content) -" - -# 4. VĂ©rifier la syntaxe Python -python3 -m py_compile status-monitor/app.py - -# 5. Commiter avec GIT_SSL_NO_VERIFY -GIT_SSL_NO_VERIFY=true git add status-monitor/app.py -GIT_SSL_NO_VERIFY=true git commit -m "Fix(status-monitor): Correction des guillemets dans le JavaScript - Resout SyntaxError loading" - -# 6. Pull avec rebase (conflit dĂ©tectĂ©) -GIT_SSL_NO_VERIFY=true git pull --rebase origin main - -# 7. Pousser vers git.peis.fr -GIT_SSL_NO_VERIFY=true git push origin main - -# 8. Deployer sur CT201 (via CT200 comme bastion) -# MĂ©thode 1 : Copier via CT200 -cat status-monitor/app.py | ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 'cat > /tmp/app_new.py' -ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 'scp /tmp/app_new.py root@192.168.0.201:/opt/status-monitor/app.py && chmod +x /opt/status-monitor/app.py' -ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 'ssh root@192.168.0.201 systemctl restart status-monitor' - -# MĂ©thode 2 : Direct avec -J (bastion) -scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 status-monitor/app.py root@192.168.0.201:/opt/status-monitor/app.py -ssh -J root@192.168.0.100 root@192.168.0.201 'chmod +x /opt/status-monitor/app.py && systemctl restart status-monitor' -``` - -**RĂ©sultat** : -- Commit `685060c` poussĂ© vers git.peis.fr -- Fichier corrigĂ© dĂ©ployĂ© sur CT201 -- Service redĂ©marrĂ© avec succĂšs - -**Leçons apprises** : -- Toujours utiliser `-J` pour le rebond SSH vers CT201 -- `GIT_SSL_NO_VERIFY=true` est nĂ©cessaire pour contourner les problĂšmes de certificat -- Utiliser `python3` pour les scripts de correction complexes -- Tester la syntaxe Python avant de deployer - ---- - -## 🚹 Erreurs Ă  Ă©viter - -- ❌ Modifier directement les fichiers sur CT201 sans passer par Git -- ❌ Oublier de faire `git pull` avant de modifier un fichier -- ❌ Oublier de commiter et pusher aprĂšs une modification -- ❌ Travailler depuis plusieurs emplacements diffĂ©rents -- ❌ Modifier les fichiers dans `C:\Users\theo\.vibe\Proxmox\inventair\` - ---- - -## ✅ Checklist avant dĂ©ploiement - -- [ ] `git pull` exĂ©cutĂ© -- [ ] Modifications testĂ©es localement -- [ ] `git add .` exĂ©cutĂ© -- [ ] `git commit -m "..."` exĂ©cutĂ© -- [ ] `git push origin main` exĂ©cutĂ© -- [ ] DĂ©ploiement vĂ©rifiĂ© sur https://status.peis.fr - ---- - -## 📊 Historique des modifications - -| Date | Commit | Description | -|------|--------|-------------| -| 2026-07-20 | `685060c` | Fix(status-monitor): Correction des guillemets dans le JavaScript - Resout SyntaxError loading | -| 2026-07-19 | `6b77f49` | Fix: Force cache refresh on /api/status endpoint | -| 2026-07-19 | `3ed1d96` | Add: deploy.sh script for DevOps workflow | -| 2026-07-19 | `da6b794` | Ajout: INSTRUCTIONS.md pour workflow Git | - ---- - -*DerniĂšre mise Ă  jour : 2026-07-20* - -*DerniĂšre mise Ă  jour : 2026-07-19* -*Pour : Mistral Vibe et agents homelab* +# AGENTS.md - Instructions pour Mistral Vibe et autres agents + +## 🎯 Workflow DevOps Homelab + +### ✅ RÈGLES FONDAMENTALES + +1. **TOUJOURS travailler depuis le dĂ©pĂŽt Git** + - DĂ©pĂŽt principal : https://git.peis.fr/VisualPCI/homelab-config + - Clone local : `~/homelab-config` (WSL) + - **JAMAIS** modifier les fichiers locaux sur `C:\Users\theo\.vibe\Proxmox\inventair\` + +2. **Avant TOUTE action** : + ```bash + cd ~/homelab-config + GIT_SSL_NO_VERIFY=true git pull origin main + ``` + +3. **AprĂšs TOUTE modification** : + ```bash + git add . + git commit -m "description claire de la modification" + GIT_SSL_NO_VERIFY=true git push origin main + ``` + +4. **Authentification Git** : + - URL : `https://Windsurf:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git` + - Utilisateur : Windsurf + - Mot de passe / token : 3N14E7GWVSgi3K + - Commit author : `Windsurf ` + +--- + +## 📁 Structure du dĂ©pĂŽt + +``` +homelab-config/ +├── AGENTS.md ← Ce fichier +├── INSTRUCTIONS.md ← Instructions gĂ©nĂ©rales +├── homelab-inventaire.md ← Inventaire principal +├── status-monitor/ ← Service de monitoring +│ ├── app.py ← Code principal (corrigĂ©) +│ ├── app_v1.py ← Backup ancienne version +│ ├── app_v2.py ← Backup ancienne version +│ ├── deploy.sh ← Script de dĂ©ploiement +│ └── dynamic_traefik.yml ← Configuration Traefik +├── traefik-config/ ← Configurations Traefik +└── procedure-*.md ← Documentations +``` + +--- + +## 🚀 DĂ©ploiement Status Monitor (CT201) + +### Serveur cible +- **IP** : 192.168.0.201 +- **Service** : `status-monitor` (systemd) +- **Dossier** : `/opt/status-monitor/` +- **URL** : https://status.peis.fr + +### Workflow de dĂ©ploiement + +**⚠ Flux obligatoire : IDE (Windows) -> WSL -> CT200/CT100 (bastion 192.168.0.100) -> CT201 (192.168.0.201)** + +``` +IDE (C:\Users\theo\homelab_ia\homelab-config) + └── copy ───> WSL (~/homelab-config) + └── scp -J root@192.168.0.100 ───> CT201 (192.168.0.201) +``` + +#### 1. Modifier le code dans l'IDE +Modifier `status-monitor/app.py` dans l'IDE Windows. + +#### 2. Synchroniser IDE -> WSL +```bash +cp /mnt/c/Users/theo/homelab_ia/homelab-config/status-monitor/app.py ~/homelab-config/status-monitor/app.py +``` + +#### 3. Commiter et pusher +```bash +cd ~/homelab-config +GIT_SSL_NO_VERIFY=true git add status-monitor/ +GIT_SSL_NO_VERIFY=true git commit -m "Fix: description de la correction" +GIT_SSL_NO_VERIFY=true git push origin main +``` + +#### 4. DĂ©ployer sur CT201 +**Option A - DĂ©ploiement automatique (recommandĂ©) :** +```bash +wsl bash ~/homelab-config/status-monitor/deploy.sh +``` +Ce script synchronise automatiquement l'IDE -> WSL puis dĂ©ploie via CT200/CT100. + +**Option B - DĂ©ploiement manuel :** +```bash +# WSL -> CT201 (rebond via CT200/CT100 bastion) +scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 ~/homelab-config/status-monitor/app.py root@192.168.0.201:/tmp/app.py + +# Installation et redĂ©marrage sur CT201 +ssh -J root@192.168.0.100 -i ~/.ssh/id_ed25519 root@192.168.0.201 'mv /tmp/app.py /opt/status-monitor/app.py && systemctl restart status-monitor' +``` + +#### 5. VĂ©rifier le dĂ©ploiement +```bash +# VĂ©rifier l'API +curl -k -s https://status.peis.fr/api/status | python3 -m json.tool + +# Ou via navigateur +https://status.peis.fr +``` + +--- + +## 🐞 Corrections courantes + +### ProblĂšme : Cache non rafraĂźchi +**SymptĂŽme** : La page status affiche des donnĂ©es anciennes + +**Cause** : `status_cache` n'Ă©tait pas rafraĂźchi aprĂšs le premier chargement + +**Solution appliquĂ©e** : +```python +# AVANT (bug) : +if not status_cache: + check_all() + +# APRÈS (corrigĂ©) : +check_all() # Toujours rafraĂźchir Ă  chaque appel +``` + +**Fichier** : `status-monitor/app.py` (ligne 372) + +--- + +## 📋 Commandes utiles + +### Git +```bash +# État +cd ~/homelab-config && git status + +# Pull +cd ~/homelab-config && git pull + +# Commit +cd ~/homelab-config && git add . && git commit -m "message" && git push + +# Voir l'historique +cd ~/homelab-config && git log --oneline --graph +``` + +### SSH CT201 (via rebond CT200) +```bash +# Se connecter (CT200 est le bastion) +ssh -J root@192.168.0.100 root@192.168.0.201 + +# Voir les logs du service +ssh -J root@192.168.0.100 root@192.168.0.201 "journalctl -u status-monitor -f" + +# État du service +ssh -J root@192.168.0.100 root@192.168.0.201 "systemctl status status-monitor" + +# RedĂ©marrer +ssh -J root@192.168.0.100 root@192.168.0.201 "systemctl restart status-monitor" +``` + +### SSH CT200 (direct) +```bash +# Se connecter directement +ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 + +# Copier des fichiers vers CT200 +scp -i ~/.ssh/id_ed25519 fichier root@192.168.0.100:/destination/ + +# Copier des fichiers de CT200 vers local +scp -i ~/.ssh/id_ed25519 root@192.168.0.100:/source/fichier ./ +``` + +### Gitea +- **URL** : https://git.peis.fr +- **Compte** : VisualPCI +- **DĂ©pĂŽt** : https://git.peis.fr/VisualPCI/homelab-config + +### Workflow complet utilisĂ© pour la correction du 20/07/2026 + +**ProblĂšme** : SyntaxError: Unexpected identifier 'card' (at index.html:101:35) +**Cause** : Dans `status-monitor/app.py`, les strings JavaScript utilisaient `class=\"` qui gĂ©nĂ©rait du code JS invalide. + +**Workflow appliquĂ©** : +```bash +# 1. Cloner depuis WSL (Ubuntu) +cd ~/homelab-config +git clone https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git + +# 2. RĂ©cupĂ©rer le fichier buggĂ© depuis CT201 (via CT200) +ssh -J root@192.168.0.100 root@192.168.0.201 cat /opt/status-monitor/app.py > status-monitor/app_from_ct201.py + +# 3. Corriger le bug avec Python (remplacer \" par ') +python3 -c " +with open('status-monitor/app.py', 'r') as f: + content = f.read() +content = content.replace('\\\"', \"'\") +with open('status-monitor/app.py', 'w') as f: + f.write(content) +" + +# 4. VĂ©rifier la syntaxe Python +python3 -m py_compile status-monitor/app.py + +# 5. Commiter avec GIT_SSL_NO_VERIFY +GIT_SSL_NO_VERIFY=true git add status-monitor/app.py +GIT_SSL_NO_VERIFY=true git commit -m "Fix(status-monitor): Correction des guillemets dans le JavaScript - Resout SyntaxError loading" + +# 6. Pull avec rebase (conflit dĂ©tectĂ©) +GIT_SSL_NO_VERIFY=true git pull --rebase origin main + +# 7. Pousser vers git.peis.fr +GIT_SSL_NO_VERIFY=true git push origin main + +# 8. Deployer sur CT201 (via CT200 comme bastion) +# MĂ©thode 1 : Copier via CT200 +cat status-monitor/app.py | ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 'cat > /tmp/app_new.py' +ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 'scp /tmp/app_new.py root@192.168.0.201:/opt/status-monitor/app.py && chmod +x /opt/status-monitor/app.py' +ssh -i ~/.ssh/id_ed25519 root@192.168.0.100 'ssh root@192.168.0.201 systemctl restart status-monitor' + +# MĂ©thode 2 : Direct avec -J (bastion) +scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 status-monitor/app.py root@192.168.0.201:/opt/status-monitor/app.py +ssh -J root@192.168.0.100 root@192.168.0.201 'chmod +x /opt/status-monitor/app.py && systemctl restart status-monitor' +``` + +**RĂ©sultat** : +- Commit `685060c` poussĂ© vers git.peis.fr +- Fichier corrigĂ© dĂ©ployĂ© sur CT201 +- Service redĂ©marrĂ© avec succĂšs + +**Leçons apprises** : +- Toujours utiliser `-J` pour le rebond SSH vers CT201 +- `GIT_SSL_NO_VERIFY=true` est nĂ©cessaire pour contourner les problĂšmes de certificat +- Utiliser `python3` pour les scripts de correction complexes +- Tester la syntaxe Python avant de deployer + +--- + +## 🚹 Erreurs Ă  Ă©viter + +- ❌ Modifier directement les fichiers sur CT201 sans passer par Git +- ❌ Oublier de faire `git pull` avant de modifier un fichier +- ❌ Oublier de commiter et pusher aprĂšs une modification +- ❌ Travailler depuis plusieurs emplacements diffĂ©rents +- ❌ Modifier les fichiers dans `C:\Users\theo\.vibe\Proxmox\inventair\` + +--- + +## ✅ Checklist avant dĂ©ploiement + +- [ ] `git pull` exĂ©cutĂ© +- [ ] Modifications testĂ©es localement +- [ ] `git add .` exĂ©cutĂ© +- [ ] `git commit -m "..."` exĂ©cutĂ© +- [ ] `git push origin main` exĂ©cutĂ© +- [ ] DĂ©ploiement vĂ©rifiĂ© sur https://status.peis.fr + +--- + +## 📊 Historique des modifications + +| Date | Commit | Description | +|------|--------|-------------| +| 2026-07-20 | `685060c` | Fix(status-monitor): Correction des guillemets dans le JavaScript - Resout SyntaxError loading | +| 2026-07-19 | `6b77f49` | Fix: Force cache refresh on /api/status endpoint | +| 2026-07-19 | `3ed1d96` | Add: deploy.sh script for DevOps workflow | +| 2026-07-19 | `da6b794` | Ajout: INSTRUCTIONS.md pour workflow Git | + +--- + +*DerniĂšre mise Ă  jour : 2026-07-20* + +*DerniĂšre mise Ă  jour : 2026-07-19* +*Pour : Mistral Vibe et agents homelab* diff --git a/INSTRUCTIONS.md b/INSTRUCTIONS.md index b7777c0..9ccbc7c 100755 --- a/INSTRUCTIONS.md +++ b/INSTRUCTIONS.md @@ -25,6 +25,38 @@ git commit -m "description claire" GIT_SSL_NO_VERIFY=true git push origin main +## FLUX DE DÉPLOIEMENT STATUS-MONITOR + +L'ordre est critique pour Ă©viter les dĂ©ploiements de vieilles versions : + +``` +IDE (Windows) ──copy──> WSL (~/homelab-config) ──scp──> CT200/CT100 (192.168.0.100 bastion) ──scp──> CT201 (192.168.0.201 status-monitor) +``` + +### Commande automatique +```bash +wsl bash ~/homelab-config/status-monitor/deploy.sh +``` + +### Commande manuelle (si deploy.sh ne fonctionne pas) +```bash +# 1. IDE -> WSL +cp /mnt/c/Users/theo/homelab_ia/homelab-config/status-monitor/app.py ~/homelab-config/status-monitor/app.py + +# 2. WSL -> CT201 (rebond via CT200/CT100) +scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 ~/homelab-config/status-monitor/app.py root@192.168.0.201:/tmp/app.py + +# 3. Installation sur CT201 +ssh -J root@192.168.0.100 -i ~/.ssh/id_ed25519 root@192.168.0.201 'mv /tmp/app.py /opt/status-monitor/app.py && systemctl restart status-monitor' +``` + +## Authentification Git (Ă  utiliser pour tous les commits) +- **Utilisateur** : `Windsurf` +- **Mot de passe / token** : `3N14E7GWVSgi3K` +- **URL du dĂ©pĂŽt** : `https://Windsurf:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git` +- **Auteur des commits** : `Windsurf ` +- Le dĂ©pĂŽt reste VisualPCI/homelab-config, l'authentification se fait avec Windsurf. + ## Sources de vĂ©ritĂ© - DĂ©pĂŽt Git : https://git.peis.fr/VisualPCI/homelab-config - Clone local : ~/homelab-config (WSL) diff --git a/status-monitor/README.md b/status-monitor/README.md index c84c9fe..30ede05 100644 --- a/status-monitor/README.md +++ b/status-monitor/README.md @@ -1,9 +1,9 @@ # Status Monitor - Homelab **Application de monitoring des services Homelab** -**Version** : 1.1.0 -**Auteur** : Mistral Vibe -**DerniĂšre mise Ă  jour** : 19/07/2026 +**Version** : 1.3.0 +**Auteur** : Windsurf +**DerniĂšre mise Ă  jour** : 20/07/2026 --- @@ -13,7 +13,13 @@ Application Python de monitoring des services Homelab. Elle vĂ©rifie rĂ©guliĂšre **FonctionnalitĂ©s** : - VĂ©rification SSH, HTTP, HTTPS -- Interface web responsive avec rafraĂźchissement automatique +- Interface web responsive moderne (glassmorphism, gradient, rounded cards) +- **Liens cliquables vers chaque service (IP:port ou URL publique HTTPS)** +- **Filtres par type de service (SSH, HTTP, HTTPS, Reverse Proxy, Others)** +- **Affichage immĂ©diat des tuiles au chargement (statut `waiting`)** +- **Label `reverse proxy` pour les services de routage Traefik** +- Page `/apps` listant les applications avec URL cliquables, ordre rĂ©ordonnable et persistant (localStorage) +- URLs publiques configurables par service (`public_url`) - Historique des changements de statut - Support des certificats SSL auto-signĂ©s (mode insecure) - Tableau de bord avec statistiques globales @@ -90,55 +96,38 @@ homelab-config/ nano C:\Users\theo\.vibe\Proxmox\inventair\status-monitor\app.py ``` -### 2. Pousser vers Git (via CT200) +### 2. Pousser vers Git depuis WSL ```bash -# Copier les fichiers modifiĂ©s vers CT200 -scp -i C:\Users\theo\.ssh\id_ed25519 app.py root@192.168.0.100:/opt/git-repos/homelab-config/status-monitor/ +# Synchroniser IDE -> WSL si nĂ©cessaire +cp /mnt/c/Users/theo/homelab_ia/homelab-config/status-monitor/app.py ~/homelab-config/status-monitor/app.py -# Sur CT200 : -ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 -cd /opt/git-repos/homelab-config - -# VĂ©rifier les changements +# Commiter et pousser avec l'utilisateur Windsurf +cd ~/homelab-config git status git diff status-monitor/ - -# Ajouter, commiter, pousser git add status-monitor/ -git commit -m "Update Status Monitor - - -Generated by Mistral Vibe. -Co-Authored-By: Mistral Vibe " -git push origin main +git commit -m "Update Status Monitor - " +GIT_SSL_NO_VERIFY=true git push origin main ``` ### 3. DĂ©ployer sur CT201 +**Flux obligatoire : IDE (Windows) -> WSL -> CT200/CT100 (bastion 192.168.0.100) -> CT201 (192.168.0.201)** + ```bash -# MĂ©thode A : ExĂ©cuter le script de dĂ©ploiement -bash /opt/git-repos/homelab-config/status-monitor/deploy.sh +# MĂ©thode A : ExĂ©cuter le script de dĂ©ploiement depuis WSL +wsl bash ~/homelab-config/status-monitor/deploy.sh # MĂ©thode B : Manuellement -ssh root@192.168.0.201 -cd /opt/status-monitor +# 1. IDE -> WSL +cp /mnt/c/Users/theo/homelab_ia/homelab-config/status-monitor/app.py ~/homelab-config/status-monitor/app.py -# Cloner ou pull le dĂ©pĂŽt -if [ ! -d "homelab-config" ]; then - git clone https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git -else - cd homelab-config - git pull - cd .. -fi +# 2. WSL -> CT201 (rebond via CT200/CT100) +scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 ~/homelab-config/status-monitor/app.py root@192.168.0.201:/tmp/app.py -# Copier les fichiers -cp -f homelab-config/status-monitor/app.py . -cp -f homelab-config/status-monitor/status-monitor.service /etc/systemd/system/ - -# RedĂ©marrer -systemctl daemon-reload -systemctl restart status-monitor +# 3. Installation sur CT201 +ssh -J root@192.168.0.100 -i ~/.ssh/id_ed25519 root@192.168.0.201 'mv /tmp/app.py /opt/status-monitor/app.py && systemctl restart status-monitor' ``` --- @@ -170,6 +159,8 @@ git push ### Historique des versions | Version | Date | Changements | |---------|------|-------------| +| 1.3.0 | 20/07/2026 | Design modernisĂ©, tuiles waiting, filtre Reverse Proxy, label reverse proxy, page `/apps` ordonnable | +| 1.2.0 | 20/07/2026 | Liens cliquables, `public_url`, filtres par type, Gitea sĂ©parĂ© | | 1.1.0 | 19/07/2026 | Version initiale dans Git | | 1.0.0 | Avant | Version initiale (non versionnĂ©e) | @@ -188,6 +179,7 @@ SERVICES = { "host": "IP ou hostname", "port": port_number, "url": "/chemin" (optionnel, pour http/https), + "public_url": "https://mon-service.peis.fr/" (optionnel, lien cliquable affichĂ©), "insecure": True | False (optionnel, pour https sans vĂ©rification SSL) }, ... @@ -196,8 +188,8 @@ SERVICES = { **Types disponibles** : - `ssh` : VĂ©rifie si le port SSH (22) est ouvert -- `http` : VĂ©rifie la rĂ©ponse HTTP sur un port -- `https` : VĂ©rifie la rĂ©ponse HTTPS sur un port +- `http` : VĂ©rifie la rĂ©ponse HTTP sur un port (lien cliquable http://host:port/url) +- `https` : VĂ©rifie la rĂ©ponse HTTPS sur un port (lien cliquable https://host:port/url ou public_url) --- @@ -206,6 +198,7 @@ SERVICES = { | Endpoint | MĂ©thode | Description | |----------|---------|-------------| | `/` | GET | Tableau de bord HTML | +| `/apps` | GET | Liste des applications (URL cliquables, ordre persistant cĂŽtĂ© client) | | `/api/status` | GET | JSON de tous les statuts | | `/api/refresh` | GET | RafraĂźchit tous les services | | `/api/check/` | GET | VĂ©rifie un service spĂ©cifique | @@ -289,9 +282,11 @@ python3 app.py | ÉlĂ©ment | Valeur | |---------|--------| | **DĂ©pĂŽt Git** | git.peis.fr/VisualPCI/homelab-config | -| **Username Git** | VisualPCI | +| **Username Git** | Windsurf | | **Token Git** | 3N14E7GWVSgi3K | +| **Auteur des commits** | Windsurf | | **Serveur de dĂ©ploiement** | CT201 (192.168.0.201) | +| **Bastion SSH** | CT200/CT100 (192.168.0.100) | | **URL publique** | https://status.peis.fr | | **Port** | 80 | @@ -300,11 +295,18 @@ python3 app.py ## 🎯 Prochaines Évolutions - [ ] Ajouter l'authentification basique -- [ ] Ajouter des notifications (email, webhook) +- [ ] Ajouter des notifications (email, webhook Discord/Slack) - [ ] IntĂ©grer avec Grafana/Prometheus -- [ ] Historique persistant en base de donnĂ©es -- [ ] Dashboard personnalisable +- [ ] Historique persistant en base de donnĂ©es (SQLite/InfluxDB) +- [ ] Dashboard personnalisable (drag & drop des cartes) +- [ ] Temps de rĂ©ponse / latence par service +- [ ] CatĂ©gories/groupes de services (Proxmox, Containers, VM, Externe) +- [ ] Mode sombre/clair +- [ ] Export CSV/PDF des statuts +- [ ] Page d'historique dĂ©taillĂ©e avec graphiques +- [ ] Gestion des certificats SSL (expiration, renouvellement) +- [ ] Support du ping ICMP en plus de TCP --- -*Documentation gĂ©nĂ©rĂ©e par Mistral Vibe - 19/07/2026* +*Documentation gĂ©nĂ©rĂ©e par Windsurf - 20/07/2026* diff --git a/status-monitor/app.py b/status-monitor/app.py index 88d1eb8..62fabc2 100755 --- a/status-monitor/app.py +++ b/status-monitor/app.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Homelab Status Monitor v1.1.1""" +"""Homelab Status Monitor v1.3.0""" import socket import ssl @@ -9,53 +9,59 @@ import threading from datetime import datetime from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer -VERSION = "1.1.1" +VERSION = "1.3.0" # Service configuration: name, type (ssh/http/https), host, port, url (for http/https), insecure (for https) +# public_url: external HTTPS URL shown as clickable link (optional) +# label: extra tag shown as badge on card, e.g. "reverse proxy" (optional) SERVICES = { # Containers LXC "ct101-mqtt": {"name": "MQTT", "type": "ssh", "host": "192.168.0.5", "port": 22}, "ct101-mqtt-http": {"name": "MQTT HTTP", "type": "http", "host": "192.168.0.5", "port": 1883, "url": "/"}, - + "ct102-frigate": {"name": "Frigate", "type": "ssh", "host": "192.168.0.91", "port": 22}, "ct102-frigate-http": {"name": "Frigate Web", "type": "http", "host": "192.168.0.91", "port": 5000, "url": "/"}, - + "ct103-adguard": {"name": "AdGuard", "type": "ssh", "host": "192.168.0.92", "port": 22}, "ct103-adguard-http": {"name": "AdGuard Web", "type": "http", "host": "192.168.0.92", "port": 80, "url": "/"}, "ct103-adguard-https": {"name": "AdGuard HTTPS", "type": "https", "host": "192.168.0.92", "port": 443, "url": "/", "insecure": True}, - + "ct105-alpine": {"name": "Alpine-Docker", "type": "ssh", "host": "192.168.0.155", "port": 22}, "ct105-alpine-docker": {"name": "Alpine Docker API", "type": "http", "host": "192.168.0.155", "port": 2375, "url": "/"}, - + "ct106-zigbee": {"name": "Zigbee2MQTT", "type": "ssh", "host": "192.168.0.177", "port": 22}, "ct106-zigbee-http": {"name": "Zigbee2MQTT Web", "type": "http", "host": "192.168.0.177", "port": 8081, "url": "/"}, - + + # Traefik (CT200/CT100) - reverse proxy, no other service mixed here "ct200-traefik": {"name": "Traefik Proxy", "type": "ssh", "host": "192.168.0.100", "port": 22}, "ct200-traefik-http": {"name": "Traefik HTTP", "type": "http", "host": "192.168.0.100", "port": 80, "url": "/"}, - "ct200-traefik-https": {"name": "Traefik HTTPS", "type": "https", "host": "192.168.0.100", "port": 443, "url": "/", "insecure": True}, - + "ct200-traefik-https": {"name": "Traefik Dashboard", "type": "https", "host": "192.168.0.100", "port": 443, "url": "/", "public_url": "https://traefik.peis.fr/dashboard/", "insecure": True}, + + # Status Monitor (CT201) "ct201-status": {"name": "Status Monitor", "type": "ssh", "host": "192.168.0.201", "port": 22}, "ct201-status-http": {"name": "Status Monitor Web", "type": "http", "host": "192.168.0.201", "port": 80, "url": "/"}, - + "ct201-status-https": {"name": "status.peis.fr", "type": "https", "host": "status.peis.fr", "port": 443, "url": "/", "public_url": "https://status.peis.fr/", "label": "reverse proxy", "insecure": True}, + + # Gitea (CT202) - own dedicated service, not mixed with Traefik "ct202-gitea": {"name": "Gitea", "type": "ssh", "host": "192.168.0.202", "port": 22}, - "ct202-gitea-http": {"name": "Gitea Web", "type": "http", "host": "192.168.0.202", "port": 3000, "url": "/"}, - + "ct202-gitea-http": {"name": "Gitea Web", "type": "http", "host": "192.168.0.202", "port": 3000, "url": "/", "public_url": "https://git.peis.fr/"}, + "ct202-gitea-https": {"name": "git.peis.fr", "type": "https", "host": "git.peis.fr", "port": 443, "url": "/", "public_url": "https://git.peis.fr/", "label": "reverse proxy", "insecure": True}, + # VM "vm100-ha": {"name": "Home Assistant", "type": "ssh", "host": "192.168.0.43", "port": 22}, - "vm100-ha-http": {"name": "Home Assistant Web", "type": "http", "host": "192.168.0.43", "port": 8123, "url": "/"}, - + "vm100-ha-http": {"name": "Home Assistant Web", "type": "http", "host": "192.168.0.43", "port": 8123, "url": "/", "public_url": "https://ha.peis.fr/"}, + # Proxmox hosts "prox": {"name": "Proxmox (prox)", "type": "ssh", "host": "192.168.0.94", "port": 22}, "prox2": {"name": "Proxmox (prox2)", "type": "ssh", "host": "192.168.0.95", "port": 22}, - + # Raspberry Pi "pi3": {"name": "Raspberry Pi 3", "type": "ssh", "host": "192.168.0.156", "port": 22}, - - # External HTTPS endpoints - "ha-peis-fr": {"name": "ha.peis.fr", "type": "https", "host": "ha.peis.fr", "port": 443, "url": "/", "insecure": True}, - "traefik-dash": {"name": "traefik.peis.fr", "type": "https", "host": "traefik.peis.fr", "port": 443, "url": "/dashboard/", "insecure": True}, - "test-peis-fr": {"name": "test.peis.fr", "type": "https", "host": "test.peis.fr", "port": 443, "url": "/", "insecure": True}, - "status-peis-fr": {"name": "status.peis.fr", "type": "https", "host": "status.peis.fr", "port": 443, "url": "/", "insecure": True}, + + # External HTTPS endpoints (Traefik reverse proxy) + "ha-peis-fr": {"name": "ha.peis.fr", "type": "https", "host": "ha.peis.fr", "port": 443, "url": "/", "public_url": "https://ha.peis.fr/", "label": "reverse proxy", "insecure": True}, + "traefik-dash": {"name": "traefik.peis.fr", "type": "https", "host": "traefik.peis.fr", "port": 443, "url": "/dashboard/", "public_url": "https://traefik.peis.fr/dashboard/", "label": "reverse proxy", "insecure": True}, + "test-peis-fr": {"name": "test.peis.fr", "type": "https", "host": "test.peis.fr", "port": 443, "url": "/", "public_url": "https://test.peis.fr/", "label": "reverse proxy", "insecure": True}, } status_history = {} @@ -161,64 +167,203 @@ def check_all(): return new_cache -# HTML Template (using a function to avoid f-string escaping issues) +# HTML Templates def generate_html(): - """Generate the HTML page.""" + """Generate the main dashboard HTML page.""" + services_json = json.dumps(SERVICES) return ''' - + Homelab Status Monitor v''' + VERSION + '''
-

Homelab Status Monitor

-
v''' + VERSION + '''
-
+
+

Homelab Status Monitor

+
v''' + VERSION + '''
+
+
+ Applications List
+
+ + + + + + +
0
Total
0
Online
@@ -228,18 +373,27 @@ def generate_html():
+ +''' + + +def generate_apps_html(): + """Generate the applications list page with sortable and persistent order.""" + apps = [] + for sid, cfg in SERVICES.items(): + url = None + if cfg.get("public_url"): + url = cfg["public_url"] + elif cfg.get("type") in ("http", "https"): + proto = cfg["type"] + url = f"{proto}://{cfg['host']}:{cfg['port']}{cfg.get('url', '/')}" + if url: + apps.append({"id": sid, "name": cfg["name"], "url": url}) + apps_json = json.dumps(apps) + return ''' + + + + + Applications - Homelab Status Monitor v''' + VERSION + ''' + + + +
+
+ ← Back to dashboard +

Applications

+
+
Drag items to reorder. The order is saved in your browser.
+
    +
    + ''' @@ -370,7 +666,13 @@ class Handler(BaseHTTPRequestHandler): self.send_header('Content-type', 'text/html; charset=utf-8') self.end_headers() self.wfile.write(generate_html().encode('utf-8')) - + + elif self.path in ['/apps', '/apps.html']: + self.send_response(200) + self.send_header('Content-type', 'text/html; charset=utf-8') + self.end_headers() + self.wfile.write(generate_apps_html().encode('utf-8')) + elif self.path == '/api/status': check_all() # Always refresh cache self.send_response(200) diff --git a/status-monitor/deploy.sh b/status-monitor/deploy.sh index 1c244cb..1f7b4f5 100755 --- a/status-monitor/deploy.sh +++ b/status-monitor/deploy.sh @@ -1,22 +1,27 @@ #!/bin/bash # Script de dĂ©ploiement DevOps pour status-monitor +# Flux: IDE (Windows) -> WSL -> CT200/CT100 (bastion 192.168.0.100) -> CT201 (192.168.0.201) # Utilisation: wsl bash ~/homelab-config/status-monitor/deploy.sh set -e -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -REPO_DIR="$(dirname "$SCRIPT_DIR")" +WSL_REPO="$HOME/homelab-config" +IDE_REPO="/mnt/c/Users/theo/homelab_ia/homelab-config" -echo "[DEPLOY] DĂ©but du dĂ©ploiement depuis Git..." +# Etape 1: Synchroniser IDE (Windows) -> WSL +if [ -d "$IDE_REPO" ] && [ -d "$WSL_REPO" ]; then + echo "[DEPLOY] Synchronisation IDE -> WSL..." + cp "$IDE_REPO/status-monitor/app.py" "$WSL_REPO/status-monitor/app.py" + sed -i 's/\r$//' "$WSL_REPO/status-monitor/app.py" + echo "[DEPLOY] OK - Source copied IDE -> WSL" +fi -echo "[DEPLOY] Transfert des fichiers vers CT201..." -scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 "$SCRIPT_DIR/app.py" root@192.168.0.201:/tmp/app.py +# Etape 2: Deploiement WSL -> CT201 via CT200/CT100 (ProxyJump) +echo "[DEPLOY] Transfert WSL -> CT201 via CT200/CT100..." +scp -J root@192.168.0.100 -i ~/.ssh/id_ed25519 "$WSL_REPO/status-monitor/app.py" root@192.168.0.201:/tmp/app.py +# Etape 3: Installation et redemarrage sur CT201 echo "[DEPLOY] Installation sur CT201..." -ssh -J root@192.168.0.100 -i ~/.ssh/id_ed25519 root@192.168.0.201 << 'ENDSSH' -mv /tmp/app.py /opt/status-monitor/app.py -systemctl restart status-monitor -echo "[DEPLOY] ✅ DĂ©ploiement terminĂ© sur CT201 !" -ENDSSH +ssh -J root@192.168.0.100 -i ~/.ssh/id_ed25519 root@192.168.0.201 "mv /tmp/app.py /opt/status-monitor/app.py && systemctl restart status-monitor && echo '[DEPLOY] OK - CT201 updated'" -echo "[DEPLOY] DĂ©ploiement terminĂ© avec succĂšs !" +echo "[DEPLOY] OK - All done: IDE -> WSL -> CT200/CT100 -> CT201"