Add AGENT_MAJ_traefik_GIT_inventaire.md - Documentation complete des configurations Traefik et synchronisation Git
Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -0,0 +1,505 @@
|
||||
# AGENT_MAJ_traefik_GIT_inventaire
|
||||
|
||||
**Objectif** : Documenter et synchroniser toutes les configurations Traefik déployées sur CT 200 (192.168.0.100) avec le dépôt Git (git.peis.fr/VisualPCI/homelab-config)
|
||||
|
||||
**Date** : 19/07/2026
|
||||
**Auteur** : Mistral Vibe
|
||||
|
||||
---
|
||||
|
||||
## 📋 Sommaire
|
||||
|
||||
1. [Contexte et état actuel](#-contexte-et-état-actuel)
|
||||
2. [Inventaire des fichiers déployés sur CT 200](#-inventaire-des-fichiers-déployés-sur-ct-200)
|
||||
3. [Services configurés](#-services-configurés)
|
||||
4. [Étapes de récupération des configurations](#-étapes-de-récupération-des-configurations)
|
||||
5. [Structure cible dans le dépôt Git](#-structure-cible-dans-le-dépôt-git)
|
||||
6. [Fichiers à ajouter/mettre à jour dans Git](#-fichiers-à-ajoutermettre-à-jour-dans-git)
|
||||
7. [Commandes de synchronisation](#-commandes-de-synchronisation)
|
||||
8. [Vérifications post-synchronisation](#-vérifications-post-synchronisation)
|
||||
|
||||
---
|
||||
|
||||
## 📌 Contexte et état actuel
|
||||
|
||||
### Situation initiale
|
||||
- **CT 200** (192.168.0.100) : Serveur Traefik principal avec HA activé
|
||||
- **Dépôt Git** : git.peis.fr/VisualPCI/homelab-config
|
||||
- **Accès SSH** : `ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100`
|
||||
- **Dossier de configuration** : `/opt/traefik/`
|
||||
|
||||
### Problème identifié
|
||||
- Les configurations sur CT 200 ont évolué (ajout de git.peis.fr, migration de ha-proxy vers services statiques)
|
||||
- Le dépôt Git n'est pas synchronisé avec l'état réel déployé
|
||||
- Certaines configurations (git-server, status-monitor) sont uniquement dans dynamic.yml
|
||||
- D'autres configurations (adguard-proxy, whoami) sont dans des fichiers docker-compose séparés
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Inventaire des fichiers déployés sur CT 200
|
||||
|
||||
### Structure complète du dossier `/opt/traefik/`
|
||||
|
||||
```
|
||||
/opt/traefik/
|
||||
├── certs/
|
||||
│ ├── acme.json # Certificats Let's Encrypt (PRODUCTION)
|
||||
│ └── local/
|
||||
│ ├── 192.168.0.43-key.pem # Clé locale pour Home Assistant
|
||||
│ └── 192.168.0.43.pem # Certificat local pour Home Assistant
|
||||
├── config/
|
||||
│ ├── adguard-nginx.conf # Proxy Nginx vers AdGuard (192.168.0.92:80)
|
||||
│ ├── dynamic.yml # Configuration dynamique ACTUELLE
|
||||
│ ├── dynamic.yml.bak # Backup (sans git-server)
|
||||
│ ├── ha-nginx.conf # Proxy Nginx vers Home Assistant (192.168.0.43:8123)
|
||||
│ └── traefik.yml # Configuration globale Traefik
|
||||
├── logs/
|
||||
│ ├── access.log
|
||||
│ └── traefik.log
|
||||
├── docker-compose.yml # Configuration principale Traefik
|
||||
├── docker-compose.yml.bak- # Backup ancien (avec ha-proxy)
|
||||
├── docker-compose-adguard.yml # Service AdGuard
|
||||
├── docker-compose-ha.yml # Service Home Assistant
|
||||
└── docker-compose-whoami.yml # Service Whoami (test.peis.fr)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Services configurés
|
||||
|
||||
### 1. Services statiques (configurés dans `dynamic.yml`)
|
||||
|
||||
Ces services sont définis directement dans le fichier de configuration dynamique :
|
||||
|
||||
| Service | Host | Destination | Type | Certificat SSL |
|
||||
|---------|------|-------------|------|-----------------|
|
||||
| homeassistant | `ha.peis.fr` | `http://192.168.0.43:8123` | Externe (CT 103) | Let's Encrypt |
|
||||
| traefik-public | `traefik.peis.fr` | `api@internal` | Interne | Let's Encrypt |
|
||||
| status-monitor | `status.peis.fr` | `http://192.168.0.201:80` | Externe (CT 201) | Let's Encrypt |
|
||||
| **git-server** | **`git.peis.fr`** | **`http://192.168.0.202:3000`** | **Externe (CT 202)** | **Let's Encrypt** ⭐ |
|
||||
|
||||
> ⭐ **Nouveau** : git-server a été ajouté récemment pour pointer vers Gitea sur CT 202
|
||||
|
||||
### 2. Services Docker (configurés via labels)
|
||||
|
||||
Ces services sont définis dans des fichiers docker-compose avec des labels Traefik :
|
||||
|
||||
| Fichier | Service | Host | Destination | Statut |
|
||||
|--------|---------|------|-------------|--------|
|
||||
| docker-compose.yml | traefik-proxy | `traefik.peis.fr` | Dashboard Traefik | ✅ En cours |
|
||||
| docker-compose-adguard.yml | adguard-proxy | `adguard.peis.fr` | Nginx → 192.168.0.92:80 | ✅ En cours |
|
||||
| docker-compose-ha.yml | homeassistant | `ha.peis.fr` | Conteneur HA | ❌ **Non lancé** |
|
||||
| docker-compose-whoami.yml | whoami | `test.peis.fr` | Conteneur whoami | ✅ En cours |
|
||||
|
||||
### 3. Services anciens (dans backup)
|
||||
|
||||
Dans `docker-compose.yml.bak-` :
|
||||
- **ha-proxy** : Conteneur Nginx pour Home Assistant (remplacé par la config statique)
|
||||
|
||||
---
|
||||
|
||||
## 📥 Étapes de récupération des configurations
|
||||
|
||||
### Étape 1 : Connexion SSH au CT 200
|
||||
```bash
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100
|
||||
```
|
||||
|
||||
### Étape 2 : Lister tous les fichiers de configuration
|
||||
```bash
|
||||
find /opt/traefik -type f | sort
|
||||
```
|
||||
|
||||
### Étape 3 : Récupérer chaque fichier de configuration
|
||||
|
||||
#### Configuration principale Traefik
|
||||
```bash
|
||||
# traefik.yml
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/config/traefik.yml"
|
||||
|
||||
# docker-compose.yml
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/docker-compose.yml"
|
||||
|
||||
# dynamic.yml (ACTUEL avec git-server)
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/config/dynamic.yml"
|
||||
```
|
||||
|
||||
#### Configurations des services
|
||||
```bash
|
||||
# AdGuard
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/docker-compose-adguard.yml"
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/config/adguard-nginx.conf"
|
||||
|
||||
# Home Assistant
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/docker-compose-ha.yml"
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/config/ha-nginx.conf"
|
||||
|
||||
# Whoami
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/docker-compose-whoami.yml"
|
||||
```
|
||||
|
||||
#### Backups
|
||||
```bash
|
||||
# Ancien docker-compose.yml avec ha-proxy
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/docker-compose.yml.bak-"
|
||||
|
||||
# Ancien dynamic.yml (sans git-server)
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100 "cat /opt/traefik/config/dynamic.yml.bak"
|
||||
```
|
||||
|
||||
### Étape 4 : Identifier les différences avec Git
|
||||
|
||||
La configuration git.peis.fr est **absente du dépôt Git** et doit être ajoutée.
|
||||
|
||||
---
|
||||
|
||||
## 🗂️ Structure cible dans le dépôt Git
|
||||
|
||||
```
|
||||
homelab-config/
|
||||
└── traefik-config/
|
||||
├── config/
|
||||
│ ├── traefik.yml # Configuration globale (à mettre à jour)
|
||||
│ ├── dynamic.yml # Configuration dynamique (à créer/ajouter)
|
||||
│ ├── adguard-nginx.conf # Proxy AdGuard (à ajouter)
|
||||
│ └── ha-nginx.conf # Proxy Home Assistant (à ajouter)
|
||||
├── certs/
|
||||
│ └── README.md # Exemple de structure (ne pas commiter acme.json)
|
||||
├── docker-compose.yml # Traefik principal (à mettre à jour)
|
||||
├── services/
|
||||
│ ├── docker-compose-adguard.yml # Service AdGuard
|
||||
│ ├── docker-compose-ha.yml # Service Home Assistant
|
||||
│ ├── docker-compose-whoami.yml # Service Whoami
|
||||
│ └── docker-compose-git.yml # ⭐ NOUVEAU : Service Git (à créer)
|
||||
└── README.md # Documentation
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Fichiers à ajouter/mettre à jour dans Git
|
||||
|
||||
### Fichiers existants à mettre à jour
|
||||
|
||||
1. **`traefik-config/config/traefik.yml`**
|
||||
- Vérifier que `certificatesResolvers.letsencrypt` est en PRODUCTION
|
||||
- Vérifier `email: theo@peis.fr`
|
||||
- Vérifier `httpChallenge` est configuré
|
||||
|
||||
2. **`traefik-config/docker-compose.yml`**
|
||||
- Mettre à jour le container_name: `traefik-proxy` (au lieu de `traefik`)
|
||||
- Vérifier les labels du dashboard
|
||||
|
||||
3. **`traefik-config/services/docker-compose-ha.yml`**
|
||||
- Ajouter la redirection HTTP→HTTPS si manquante
|
||||
|
||||
### Nouveaux fichiers à ajouter
|
||||
|
||||
1. **`traefik-config/config/dynamic.yml`** ⭐ **NOUVEAU**
|
||||
```yaml
|
||||
http:
|
||||
routers:
|
||||
homeassistant:
|
||||
rule: "Host(`ha.peis.fr`)"
|
||||
entryPoints:
|
||||
- "websecure"
|
||||
tls:
|
||||
certResolver: "letsencrypt"
|
||||
service: homeassistant
|
||||
middlewares:
|
||||
- "security-headers"
|
||||
|
||||
traefik-public:
|
||||
rule: "Host(`traefik.peis.fr`)"
|
||||
service: api@internal
|
||||
entryPoints:
|
||||
- "websecure"
|
||||
tls:
|
||||
certResolver: "letsencrypt"
|
||||
middlewares:
|
||||
- "auth"
|
||||
|
||||
status-monitor:
|
||||
rule: "Host(`status.peis.fr`)"
|
||||
entryPoints:
|
||||
- "websecure"
|
||||
tls:
|
||||
certResolver: "letsencrypt"
|
||||
service: status-monitor
|
||||
|
||||
git-server:
|
||||
rule: "Host(`git.peis.fr`)"
|
||||
entryPoints:
|
||||
- "websecure"
|
||||
tls:
|
||||
certResolver: "letsencrypt"
|
||||
service: git-server
|
||||
|
||||
services:
|
||||
homeassistant:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://192.168.0.43:8123"
|
||||
|
||||
status-monitor:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://192.168.0.201:80"
|
||||
|
||||
git-server:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://192.168.0.202:3000"
|
||||
|
||||
middlewares:
|
||||
auth:
|
||||
basicAuth:
|
||||
users:
|
||||
- "admin:$apr1$xnK9sM6u$q81sJuvBe5R3rfefqDLuk1"
|
||||
security-headers:
|
||||
headers:
|
||||
frameDeny: true
|
||||
sslRedirect: true
|
||||
browserXssFilter: true
|
||||
contentTypeNosniff: true
|
||||
forceSTSHeader: true
|
||||
stsIncludeSubdomains: true
|
||||
stsPreload: true
|
||||
stsSeconds: 31536000
|
||||
customResponseHeaders:
|
||||
X-Robots-Tag: "none,noarchive,nosnippet,notranslate,noimageindex"
|
||||
X-Content-Type-Options: "nosniff"
|
||||
X-Frame-Options: "DENY"
|
||||
X-XSS-Protection: "1; mode=block"
|
||||
Referrer-Policy: "strict-origin-when-cross-origin"
|
||||
Permissions-Policy: "camera=(), microphone=(), geolocation()"
|
||||
```
|
||||
|
||||
2. **`traefik-config/config/adguard-nginx.conf`** ⭐ **NOUVEAU**
|
||||
```nginx
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
upstream adguard {
|
||||
server 192.168.0.92:80;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name adguard.peis.fr;
|
||||
|
||||
location / {
|
||||
proxy_pass http://adguard;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **`traefik-config/config/ha-nginx.conf`** ⭐ **NOUVEAU**
|
||||
```nginx
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
upstream homeassistant {
|
||||
server 192.168.0.43:8123;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name ha.peis.fr;
|
||||
|
||||
location / {
|
||||
proxy_pass http://homeassistant;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
4. **`traefik-config/docker-compose-adguard.yml`** ⭐ **NOUVEAU**
|
||||
```yaml
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
adguard-proxy:
|
||||
image: nginx:alpine
|
||||
container_name: adguard-proxy
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./config/adguard-nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# HTTP to HTTPS redirect
|
||||
- "traefik.http.routers.adguard-http.rule=Host(`adguard.peis.fr`)"
|
||||
- "traefik.http.routers.adguard-http.entrypoints=web"
|
||||
- "traefik.http.routers.adguard-http.middlewares=redirect-to-https@file"
|
||||
# HTTPS
|
||||
- "traefik.http.routers.adguard.rule=Host(`adguard.peis.fr`)"
|
||||
- "traefik.http.routers.adguard.entrypoints=websecure"
|
||||
- "traefik.http.routers.adguard.tls=true"
|
||||
- "traefik.http.routers.adguard.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.adguard.loadbalancer.server.port=80"
|
||||
networks:
|
||||
- traefik_network
|
||||
|
||||
networks:
|
||||
traefik_network:
|
||||
external: true
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Commandes de synchronisation
|
||||
|
||||
### Prérequis
|
||||
1. Cloner le dépôt (si non déjà fait) :
|
||||
```bash
|
||||
git clone https://git.peis.fr/VisualPCI/homelab-config.git
|
||||
cd homelab-config/traefik-config
|
||||
```
|
||||
|
||||
2. Récupérer les fichiers depuis CT 200 :
|
||||
```bash
|
||||
# Créer la structure
|
||||
mkdir -p config services
|
||||
|
||||
# Récupérer tous les fichiers
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/config/*.yml config/
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/config/*.conf config/
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/docker-compose*.yml ./
|
||||
```
|
||||
|
||||
### Mise à jour du dépôt
|
||||
|
||||
```bash
|
||||
# Se positionner dans le dépôt
|
||||
cd homelab-config/traefik-config
|
||||
|
||||
# Copier les nouveaux fichiers
|
||||
cp /tmp/traefik-config-backup/config/dynamic.yml config/
|
||||
cp /tmp/traefik-config-backup/config/adguard-nginx.conf config/
|
||||
cp /tmp/traefik-config-backup/config/ha-nginx.conf config/
|
||||
cp /tmp/traefik-config-backup/docker-compose-adguard.yml services/
|
||||
|
||||
# Vérifier les différences
|
||||
git status
|
||||
git diff
|
||||
|
||||
# Ajouter les nouveaux fichiers
|
||||
git add config/dynamic.yml
|
||||
git add config/adguard-nginx.conf
|
||||
git add config/ha-nginx.conf
|
||||
git add services/docker-compose-adguard.yml
|
||||
|
||||
# Mettre à jour les fichiers existants
|
||||
git add config/traefik.yml
|
||||
git add docker-compose.yml
|
||||
git add services/docker-compose-ha.yml
|
||||
|
||||
# Commit
|
||||
git commit -m "MAJ: Synchronisation complete avec CT 200 production
|
||||
- Ajout configuration git.peis.fr (git-server)
|
||||
- Ajout configuration status.peis.fr (status-monitor)
|
||||
- Ajout proxy AdGuard (adguard.peis.fr)
|
||||
- Migration HA vers services statiques
|
||||
- Mise a jour traefik.yml et docker-compose.yml
|
||||
|
||||
Generated by Mistral Vibe.
|
||||
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>"
|
||||
|
||||
# Push
|
||||
git push origin main
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Vérifications post-synchronisation
|
||||
|
||||
### 1. Vérifier que tous les services sont configurés
|
||||
```bash
|
||||
# Sur CT 200, après déploiement
|
||||
docker exec traefik-proxy traefik config display --api
|
||||
```
|
||||
|
||||
### 2. Tester chaque service
|
||||
```bash
|
||||
# Tester les URLs HTTPS
|
||||
curl -vk https://traefik.peis.fr # Dashboard
|
||||
curl -vk https://ha.peis.fr # Home Assistant
|
||||
curl -vk https://adguard.peis.fr # AdGuard
|
||||
curl -vk https://test.peis.fr # Whoami
|
||||
curl -vk https://git.peis.fr # Gitea
|
||||
curl -vk https://status.peis.fr # Status Monitor
|
||||
```
|
||||
|
||||
### 3. Vérifier les certificats
|
||||
```bash
|
||||
# Lister les certificats obtenus
|
||||
docker exec traefik-proxy cat /etc/traefik/certs/acme.json | jq '.letsencrypt.Certificates[].Domain.Main'
|
||||
|
||||
# Vérifier un certificat spécifique
|
||||
openssl s_client -connect git.peis.fr:443 -servername git.peis.fr | openssl x509 -noout -text | grep -A5 "Subject:"
|
||||
```
|
||||
|
||||
### 4. Vérifier les logs Traefik
|
||||
```bash
|
||||
# Voir les erreurs
|
||||
docker logs traefik-proxy | grep -i error
|
||||
|
||||
# Voir les obtentions de certificats
|
||||
docker logs traefik-proxy | grep -i "certificate\|acme"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📝 Résumé des actions
|
||||
|
||||
| Action | Statut | Fichier | Priorité |
|
||||
|--------|--------|---------|----------|
|
||||
| Récupérer dynamic.yml depuis CT 200 | ✅ | config/dynamic.yml | **HAUTE** ⭐ |
|
||||
| Récupérer adguard-nginx.conf | ✅ | config/adguard-nginx.conf | Haute |
|
||||
| Récupérer ha-nginx.conf | ✅ | config/ha-nginx.conf | Haute |
|
||||
| Récupérer docker-compose-adguard.yml | ✅ | services/docker-compose-adguard.yml | Haute |
|
||||
| Mettre à jour traefik.yml | ✅ | config/traefik.yml | Moyenne |
|
||||
| Mettre à jour docker-compose.yml | ✅ | docker-compose.yml | Moyenne |
|
||||
| Ajouter git-server à dynamic.yml | ✅ | config/dynamic.yml | **HAUTE** ⭐ |
|
||||
| Supprimer les backups locaux | ⏸️ | .bak, .bak- | Basse |
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Prochaines étapes
|
||||
|
||||
1. **Synchroniser immédiatement** : Les configurations git.peis.fr et status.peis.fr ne sont pas dans Git
|
||||
2. **Tester le déploiement** : Après push, déployer sur CT 200 et vérifier tous les services
|
||||
3. **Documenter** : Mettre à jour la documentation avec les nouvelles configurations
|
||||
4. **Nettoyer** : Supprimer les fichiers de backup (.bak, .bak-) après validation
|
||||
|
||||
---
|
||||
|
||||
**Note** : Les fichiers `acme.json` et `certs/local/*` **ne doivent PAS** être commités dans Git (contiennent des secrets et certificats privés).
|
||||
|
||||
---
|
||||
|
||||
*Document généré par Mistral Vibe - 19/07/2026*
|
||||
Reference in New Issue
Block a user