This commit is contained in:
Mistral
2026-07-19 15:52:39 +02:00
parent 90c473f45f
commit 72348e335b
Executable
+185
View File
@@ -0,0 +1,185 @@
# 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 pull
```
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
```
---
## 📁 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
```bash
# Se connecter
ssh root@192.168.0.201
# Voir les logs du service
ssh root@192.168.0.201 "journalctl -u status-monitor -f"
# État du service
ssh root@192.168.0.201 "systemctl status status-monitor"
# Redémarrer
ssh root@192.168.0.201 "systemctl restart status-monitor"
```
### Gitea
- **URL** : https://git.peis.fr
- **Compte** : VisualPCI
- **Dépôt** : https://git.peis.fr/VisualPCI/homelab-config
---
## 🚨 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-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-19*
*Pour : Mistral Vibe et agents homelab*