docs: Ajout du guide AGENT_MAJ_traefik_GIT_inventaire avec workflow Git complet
This commit is contained in:
+613
-251
@@ -1,237 +1,238 @@
|
||||
# AGENT_MAJ_traefik_GIT_inventaire
|
||||
|
||||
**Objectif** : Documenter et synchroniser toutes les configurations Traefik deployees sur CT 200 (192.168.0.100) avec le depot Git (git.peis.fr/VisualPCI/homelab-config). Fournir un mode operatoire generique pour les operations pull/push via CT200 comme serveur de rebond.
|
||||
**Objectif** : Documenter et synchroniser toutes les configurations Traefik et services deployes sur CT 200 (192.168.0.100) et CT 201 (192.168.0.201) avec le depot Git (git.peis.fr/VisualPCI/homelab-config)
|
||||
|
||||
**Date** : 19/07/2026
|
||||
**Auteur** : Mistral Vibe
|
||||
**Version** : 2.0 - Mode operatoire valide avec authentification Gitea
|
||||
**Date** : 19/07/2026
|
||||
**Auteur** : Mistral Vibe
|
||||
|
||||
---
|
||||
|
||||
## Sommaire
|
||||
## 📋 Sommaire
|
||||
|
||||
1. [Contexte et etat actuel](#contexte-et-etat-actuel)
|
||||
2. [Configuration d'acces Git via CT200 (Mode Operatoire Generique)](#configuration-dacces-git-via-ct200-mode-operatoire-generique)
|
||||
3. [Inventaire des fichiers deployes sur CT 200](#inventaire-des-fichiers-deployes-sur-ct-200)
|
||||
4. [Services configures](#services-configures)
|
||||
5. [Procedures de synchronisation Git](#procedures-de-synchronisation-git)
|
||||
6. [Verifications post-synchronisation](#verifications-post-synchronisation)
|
||||
1. [Contexte et état actuel](#-contexte-et-état-actuel)
|
||||
2. [Configuration Git et Authentification](#-configuration-git-et-authentification)
|
||||
3. [Workflow Git Générique](#-workflow-git-générique)
|
||||
4. [Inventaire des fichiers déployés sur CT 200](#-inventaire-des-fichiers-déployés-sur-ct-200)
|
||||
5. [Status Monitor Configuration](#-status-monitor-configuration)
|
||||
6. [Services configurés](#-services-configurés)
|
||||
7. [Étapes de récupération des configurations](#-étapes-de-récupération-des-configurations)
|
||||
8. [Structure cible dans le dépôt Git](#-structure-cible-dans-le-dépôt-git)
|
||||
9. [Fichiers à ajouter/mettre à jour dans Git](#-fichiers-à-ajoutermettre-à-jour-dans-git)
|
||||
10. [Commandes de synchronisation](#-commandes-de-synchronisation)
|
||||
11. [Vérifications post-synchronisation](#-vérifications-post-synchronisation)
|
||||
|
||||
---
|
||||
|
||||
## Contexte et etat actuel
|
||||
## 📌 Contexte et état actuel
|
||||
|
||||
### Situation initiale
|
||||
- **CT 200** (192.168.0.100) : Serveur Traefik principal avec HA active
|
||||
- **Depot Git** : git.peis.fr/VisualPCI/homelab-config (Gitea)
|
||||
- **Acces SSH a CT200** : `ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100`
|
||||
- **Dossier de configuration** : `/opt/traefik/`
|
||||
- **Serveur Git** : Gitea sur CT 202 (192.168.0.202:3000), accessible via git.peis.fr
|
||||
- **CT 200** (192.168.0.100) : Serveur Traefik principal avec HA activé
|
||||
- **CT 201** (192.168.0.201) : Serveur Status Monitor
|
||||
- **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 Traefik** : `/opt/traefik/`
|
||||
- **Dossier Status Monitor** : `/opt/status-monitor/`
|
||||
|
||||
### Problematique d'acces
|
||||
- **git.peis.fr** est accessible depuis Internet (82.67.139.7) via HTTPS (port 443)
|
||||
- **Le port 22 (SSH) n'est pas forward** vers CT200
|
||||
- **Solution** : Utiliser CT200 comme serveur de rebond pour toutes les operations Git
|
||||
- **Authentification** : Token Gitea = `3N14E7GWVSgi3K` / Username = `VisualPCI`
|
||||
### 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
|
||||
- Le code status-monitor n'est pas encore dans le dépôt Git
|
||||
|
||||
---
|
||||
|
||||
## Configuration d'acces Git via CT200 (Mode Operatoire Generique)
|
||||
## 🔐 Configuration Git et Authentification
|
||||
|
||||
### Pre-requis sur CT200
|
||||
### Identifiants Git
|
||||
- **URL du dépôt** : `https://git.peis.fr/VisualPCI/homelab-config`
|
||||
- **Utilisateur** : `VisualPCI`
|
||||
- **Mot de passe** : `3N14E7GWVSgi3K`
|
||||
- **URL avec authentification** : `https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git`
|
||||
|
||||
### Configuration SSH et Rebonds
|
||||
- **Serveur de rebond (Bastion)** : CT 200 (192.168.0.100)
|
||||
- **Clé SSH** : `C:\Users\theo\.ssh\id_ed25519`
|
||||
- **Connexion à CT201 via CT200** :
|
||||
```bash
|
||||
ssh -J root@192.168.0.100 root@192.168.0.201
|
||||
```
|
||||
- **Connexion directe à CT200** :
|
||||
```bash
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Workflow Git Générique
|
||||
|
||||
### 1. Clonage du dépôt (première fois)
|
||||
```bash
|
||||
# 1. Installer git si non present
|
||||
apt update && apt install -y git
|
||||
|
||||
# 2. Configurer l'identite git (une seule fois)
|
||||
git config --global user.name "Mistral Vibe"
|
||||
git config --global user.email "theo@peis.fr"
|
||||
|
||||
# 3. Configurer le fichier .netrc pour l'authentification Gitea
|
||||
# (stocke les credentials pour git.peis.fr)
|
||||
cat > ~/.netrc << 'NETRCEOF'
|
||||
machine git.peis.fr
|
||||
login VisualPCI
|
||||
password 3N14E7GWVSgi3K
|
||||
NETRCEOF
|
||||
chmod 600 ~/.netrc
|
||||
|
||||
# 4. Verifier que la cle SSH existe (pour scp depuis Windows)
|
||||
ls -la ~/.ssh/id_ed25519
|
||||
```
|
||||
|
||||
### Configuration du depot Git (une seule fois)
|
||||
|
||||
```bash
|
||||
# Cloner le depot (via HTTPS avec .netrc)
|
||||
git clone https://git.peis.fr/VisualPCI/homelab-config.git
|
||||
git clone https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git
|
||||
cd homelab-config
|
||||
|
||||
# Configurer le remote (optionnel, pour push/pull)
|
||||
git remote set-url origin https://git.peis.fr/VisualPCI/homelab-config.git
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Mode Operatoire Generique pour Pull/Push via CT200
|
||||
|
||||
### Cas 1 : PULL (Recuperer depuis Git vers CT200)
|
||||
|
||||
### 2. Pull des dernières modifications
|
||||
```bash
|
||||
# 1. Se connecter a CT200
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100
|
||||
|
||||
# 2. Aller dans le depot et faire pull
|
||||
cd /opt/git-repos/homelab-config
|
||||
git pull
|
||||
|
||||
# 3. Copier les fichiers vers /opt/traefik/ (si besoin)
|
||||
cp -r homelab-config/traefik-config/* /opt/traefik/
|
||||
cd /chemin/vers/homelab-config
|
||||
git pull origin main
|
||||
```
|
||||
|
||||
### Cas 2 : PUSH (Envoyer vers Git depuis CT200)
|
||||
|
||||
### 3. Push des modifications
|
||||
```bash
|
||||
# 1. Copier les fichiers depuis /opt/traefik/ vers le depot
|
||||
cd /opt/git-repos/homelab-config
|
||||
cp /opt/traefik/fichier_to_add .
|
||||
|
||||
# 2. Ou depuis Windows, copier vers CT200 d'abord
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 fichier_local root@192.168.0.100:/opt/git-repos/homelab-config/
|
||||
|
||||
# 3. Puis sur CT200 :
|
||||
cd /opt/git-repos/homelab-config
|
||||
git add fichier_to_add
|
||||
git commit -m "Add fichier_to_add - description du fichier
|
||||
|
||||
Generated by Mistral Vibe.
|
||||
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>"
|
||||
cd /chemin/vers/homelab-config
|
||||
git add .
|
||||
git commit -m "Votre message de commit"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### Cas 3 : PULL depuis Windows (via CT200 comme rebond)
|
||||
|
||||
### 4. Gestion des tags (versioning)
|
||||
```bash
|
||||
# Methode 1 : scp depuis CT200
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/git-repos/homelab-config/fichier C:\chemin\local\
|
||||
# Creer un nouveau tag
|
||||
git tag -a v1.1.0 -m "Version 1.1.0 - Ajout status-monitor"
|
||||
|
||||
# Pousser le tag vers le depot
|
||||
git push origin v1.1.0
|
||||
|
||||
# Lister les tags
|
||||
git tag -l
|
||||
|
||||
# Supprimer un tag local
|
||||
git tag -d v1.0.0
|
||||
|
||||
# Supprimer un tag distant
|
||||
git push --delete origin v1.0.0
|
||||
```
|
||||
|
||||
### Cas 4 : PUSH depuis Windows (via CT200)
|
||||
|
||||
### 5. Workflow complet pour une mise à jour
|
||||
```bash
|
||||
# 1. Copier le fichier vers CT200
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 fichier_local root@192.168.0.100:/tmp/
|
||||
|
||||
# 2. Sur CT200, le deplacer vers le depot git
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100
|
||||
# 1. Se positionner dans le depot
|
||||
cd /opt/git-repos/homelab-config
|
||||
cp /tmp/fichier_local .
|
||||
git add fichier_local
|
||||
git commit -m "Add fichier_local via Windows"
|
||||
|
||||
# 2. Pull des dernieres modifications
|
||||
git pull origin main
|
||||
|
||||
# 3. Copier les fichiers modifies depuis CT200
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/config/dynamic.yml traefik-config/config/
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/docker-compose.yml traefik-config/
|
||||
|
||||
# 4. Verifier les differences
|
||||
git status
|
||||
git diff
|
||||
|
||||
# 5. Ajouter, commiter, pusher
|
||||
git add .
|
||||
git commit -m "MAJ: <description des modifications>"
|
||||
git push origin main
|
||||
|
||||
# 6. Deployer sur CT200 (optionnel - voir section deploiement)
|
||||
```
|
||||
|
||||
### 6. Script de deploiement generique
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Script: deploy_traefik.sh
|
||||
|
||||
REPO_DIR="/opt/git-repos/homelab-config"
|
||||
TRAEFIK_DIR="/opt/traefik"
|
||||
GIT_URL="https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git"
|
||||
|
||||
# Mettre a jour le depot
|
||||
cd $REPO_DIR
|
||||
git pull origin main
|
||||
|
||||
# Copier les fichiers de configuration
|
||||
cp -r $REPO_DIR/traefik-config/config/* $TRAEFIK_DIR/config/
|
||||
cp $REPO_DIR/traefik-config/docker-compose.yml $TRAEFIK_DIR/
|
||||
|
||||
# Redemarrer Traefik
|
||||
cd $TRAEFIK_DIR
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
|
||||
# Verification
|
||||
echo "=== Verification du deploiement ==="
|
||||
docker exec traefik-proxy traefik config display --api
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Configuration du fichier .ssh/config sur Windows (Recommande)
|
||||
## 📊 Status Monitor Configuration
|
||||
|
||||
Pour simplifier les operations, creez `C:\Users\theo\.ssh\config` :
|
||||
### Localisation
|
||||
- **Serveur** : CT 201 (192.168.0.201)
|
||||
- **Dossier** : `/opt/status-monitor/`
|
||||
- **URL** : `https://status.peis.fr`
|
||||
- **Port** : 80 (expose via Traefik sur CT 200)
|
||||
|
||||
### Structure des fichiers sur CT 201
|
||||
```
|
||||
# CT200 (serveur de rebond)
|
||||
Host ct200
|
||||
HostName 192.168.0.100
|
||||
User root
|
||||
IdentityFile C:\Users\theo\.ssh\id_ed25519
|
||||
IdentitiesOnly yes
|
||||
|
||||
# CT202 (via CT200 comme proxy)
|
||||
Host ct202
|
||||
HostName 192.168.0.202
|
||||
User root
|
||||
IdentityFile C:\Users\theo\.ssh\id_ed25519
|
||||
ProxyJump ct200
|
||||
IdentitiesOnly yes
|
||||
/opt/status-monitor/
|
||||
├── app.py # Application principale (Flask)
|
||||
├── deploy.sh # Script de deploiement
|
||||
├── requirements.txt # Dependances Python
|
||||
├── status-monitor.service # Service systemd
|
||||
├── VERSION # Fichier de version
|
||||
└── README.md # Documentation
|
||||
```
|
||||
|
||||
**Avantage** : Permet d'utiliser `ssh ct202` au lieu de la commande complete.
|
||||
|
||||
---
|
||||
|
||||
## Procedures de synchronisation Git (Mode Operatoire Complet)
|
||||
|
||||
### Procedures Preliminaires (une seule fois)
|
||||
|
||||
### Commandes de recuperation depuis CT 201
|
||||
```bash
|
||||
# Sur CT200 :
|
||||
# 1. Creer le repertoire de travail
|
||||
mkdir -p /opt/git-repos
|
||||
# Lister les fichiers
|
||||
ssh -J root@192.168.0.100 root@192.168.0.201 "find /opt/status-monitor -type f | sort"
|
||||
|
||||
# 2. Configurer .netrc
|
||||
cat > ~/.netrc << 'NETRCEOF'
|
||||
machine git.peis.fr
|
||||
login VisualPCI
|
||||
password 3N14E7GWVSgi3K
|
||||
NETRCEOF
|
||||
chmod 600 ~/.netrc
|
||||
# Recuperer tous les fichiers
|
||||
scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/* ./status-monitor/
|
||||
|
||||
# 3. Cloner le depot
|
||||
git clone https://git.peis.fr/VisualPCI/homelab-config.git /opt/git-repos/homelab-config
|
||||
|
||||
# 4. Configurer git
|
||||
git config --global user.name "Mistral Vibe"
|
||||
git config --global user.email "theo@peis.fr"
|
||||
# Recuperer un fichier spécifique
|
||||
scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/app.py ./status-monitor/
|
||||
```
|
||||
|
||||
### Procedures Courantes
|
||||
|
||||
#### 1. Ajouter un fichier depuis Windows
|
||||
### Structure dans Git
|
||||
```
|
||||
homelab-config/
|
||||
└── status-monitor/
|
||||
├── app.py # Application Flask
|
||||
├── deploy.sh # Script de deploiement
|
||||
├── requirements.txt # Dependances Python
|
||||
├── status-monitor.service # Service systemd
|
||||
├── VERSION # Fichier de version
|
||||
└── README.md # Documentation
|
||||
```
|
||||
|
||||
### Workflow Status Monitor
|
||||
```bash
|
||||
# Etape 1 : Copier le fichier vers CT200
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 fichier_to_push root@192.168.0.100:/opt/git-repos/homelab-config/
|
||||
# 1. Recuperer le code depuis CT201
|
||||
cd homelab-config
|
||||
mkdir -p status-monitor
|
||||
scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/* status-monitor/
|
||||
|
||||
# Etape 2 : Sur CT200, commit et push
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100
|
||||
cd /opt/git-repos/homelab-config
|
||||
git add fichier_to_push
|
||||
git commit -m "Add fichier_to_push - description here
|
||||
|
||||
Generated by Mistral Vibe.
|
||||
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>"
|
||||
# 2. Ajouter au depot
|
||||
git add status-monitor/
|
||||
git commit -m "feat(status-monitor): Ajout du code source v1.1.0"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
#### 2. Mettre a jour un fichier existant
|
||||
# 3. Creer un tag
|
||||
git tag -a v1.1.0 -m "Version 1.1.0 - Ajout status-monitor"
|
||||
git push origin v1.1.0
|
||||
|
||||
```bash
|
||||
# Memes etapes que ci-dessus, mais avec git add fichier_modifie
|
||||
```
|
||||
|
||||
#### 3. Pull les dernieres modifications
|
||||
|
||||
```bash
|
||||
# Sur CT200 :
|
||||
cd /opt/git-repos/homelab-config
|
||||
git pull
|
||||
|
||||
# Pour recuperer un fichier sur Windows :
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/git-repos/homelab-config/fichier C:\chemin\local\
|
||||
# 4. Deployer depuis Git vers CT201
|
||||
scp -J root@192.168.0.100 status-monitor/* root@192.168.0.201:/opt/status-monitor/
|
||||
ssh -J root@192.168.0.100 root@192.168.0.201 "cd /opt/status-monitor && ./deploy.sh"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Inventaire des fichiers deployes sur CT 200
|
||||
## 🔍 Inventaire des fichiers déployés sur CT 200
|
||||
|
||||
### Structure complete du dossier /opt/traefik/
|
||||
### Structure complète du dossier `/opt/traefik/`
|
||||
|
||||
```
|
||||
/opt/traefik/
|
||||
├── certs/
|
||||
│ ├── acme.json # Certificats Let's Encrypt (PRODUCTION)
|
||||
│ └── local/
|
||||
│ ├── 192.168.0.43-key.pem # Cle locale pour Home Assistant
|
||||
│ ├── 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)
|
||||
@@ -251,132 +252,493 @@ scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/git-repos/homelab-c
|
||||
|
||||
---
|
||||
|
||||
## Services configures
|
||||
## 🚀 Services configurés
|
||||
|
||||
### 1. Services statiques (configures dans dynamic.yml)
|
||||
### 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 |
|
||||
| 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** ⭐ |
|
||||
|
||||
### 2. Services Docker (configures via labels)
|
||||
> ⭐ **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 vers 192.168.0.92:80 | En cours |
|
||||
| docker-compose-ha.yml | homeassistant | ha.peis.fr | Conteneur HA | Non lance |
|
||||
| docker-compose-whoami.yml | whoami | test.peis.fr | Conteneur whoami | En cours |
|
||||
| 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)
|
||||
|
||||
---
|
||||
|
||||
## Commandes de synchronisation (avec Mode Operatoire)
|
||||
|
||||
### Recuperer les fichiers depuis CT 200
|
||||
## 📥 Étapes de récupération des configurations
|
||||
|
||||
### Étape 1 : Connexion SSH au CT 200
|
||||
```bash
|
||||
# Sur CT200 :
|
||||
cd /opt/git-repos/homelab-config
|
||||
|
||||
# Copier les fichiers de configuration
|
||||
cp /opt/traefik/config/*.yml config/
|
||||
cp /opt/traefik/config/*.conf config/
|
||||
cp /opt/traefik/docker-compose*.yml services/
|
||||
|
||||
# Voir ce qui a change
|
||||
git status
|
||||
git diff
|
||||
ssh -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100
|
||||
```
|
||||
|
||||
### Synchroniser avec Git
|
||||
### É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
|
||||
└── status-monitor/
|
||||
├── app.py # Application Flask (v1.1.0)
|
||||
├── deploy.sh # Script de deploiement
|
||||
├── requirements.txt # Dependances Python
|
||||
├── status-monitor.service # Service systemd
|
||||
├── VERSION # Fichier de version (1.1.0)
|
||||
└── 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) avec authentification :
|
||||
```bash
|
||||
git clone https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git
|
||||
cd homelab-config
|
||||
```
|
||||
|
||||
2. Configurer le remote avec authentification (optionnel) :
|
||||
```bash
|
||||
git remote set-url origin https://VisualPCI:3N14E7GWVSgi3K@git.peis.fr/VisualPCI/homelab-config.git
|
||||
```
|
||||
|
||||
3. Récupérer les fichiers depuis CT 200 et CT 201 :
|
||||
```bash
|
||||
# Créer la structure
|
||||
mkdir -p traefik-config/config traefik-config/services status-monitor
|
||||
|
||||
# Récupérer les fichiers Traefik depuis CT 200
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/config/*.yml traefik-config/config/
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/config/*.conf traefik-config/config/
|
||||
scp -i C:\Users\theo\.ssh\id_ed25519 root@192.168.0.100:/opt/traefik/docker-compose*.yml traefik-config/
|
||||
|
||||
# Récupérer les fichiers Status Monitor depuis CT 201 (via CT 200)
|
||||
scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/* status-monitor/
|
||||
```
|
||||
|
||||
### Mise à jour du dépôt
|
||||
|
||||
```bash
|
||||
# Ajouter tous les nouveaux fichiers
|
||||
# Se positionner dans le depot
|
||||
cd homelab-config
|
||||
|
||||
# Copier les nouveaux fichiers Traefik
|
||||
cp /tmp/traefik-config-backup/config/dynamic.yml traefik-config/config/
|
||||
cp /tmp/traefik-config-backup/config/adguard-nginx.conf traefik-config/config/
|
||||
cp /tmp/traefik-config-backup/config/ha-nginx.conf traefik-config/config/
|
||||
cp /tmp/traefik-config-backup/docker-compose-adguard.yml traefik-config/services/
|
||||
|
||||
# Copier les fichiers Status Monitor
|
||||
cp /tmp/status-monitor-backup/* status-monitor/
|
||||
|
||||
# Vérifier les différences
|
||||
git status
|
||||
git diff
|
||||
|
||||
# Ajouter tous les fichiers modifies et nouveaux
|
||||
git add .
|
||||
|
||||
# Ou ajouter specifiquement
|
||||
git add config/dynamic.yml
|
||||
|
||||
# Commit
|
||||
git commit -m "MAJ: Synchronisation avec CT 200
|
||||
- Description des changements
|
||||
# Commit avec message descriptif
|
||||
git commit -m "MAJ: Synchronisation complete avec CT 200 et CT 201
|
||||
- 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
|
||||
- Ajout du code source status-monitor v1.1.0
|
||||
|
||||
Generated by Mistral Vibe.
|
||||
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>"
|
||||
|
||||
# Push
|
||||
# Push vers le depot avec authentification
|
||||
git push origin main
|
||||
|
||||
# Creer un tag pour le versioning
|
||||
git tag -a v1.1.0 -m "Version 1.1.0 - Synchronisation complete Traefik + Status Monitor"
|
||||
git push origin v1.1.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verifications post-synchronisation
|
||||
|
||||
### 1. Verifier sur Git
|
||||
### Synchronisation Status Monitor uniquement
|
||||
|
||||
```bash
|
||||
# Sur CT200 :
|
||||
cd /opt/git-repos/homelab-config
|
||||
git log --oneline -5
|
||||
# Se positionner dans le dossier status-monitor
|
||||
cd homelab-config/status-monitor
|
||||
|
||||
# Pull des dernieres modifications
|
||||
git pull origin main
|
||||
|
||||
# Recuperer les modifications depuis CT201
|
||||
scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/app.py ./
|
||||
scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/deploy.sh ./
|
||||
|
||||
# Verifier les differences
|
||||
git status
|
||||
git diff
|
||||
|
||||
# Ajouter, commiter, pusher
|
||||
git add .
|
||||
git commit -m "feat(status-monitor): Mise a jour du code"
|
||||
git push origin main
|
||||
|
||||
# Deployer vers CT201
|
||||
scp -J root@192.168.0.100 *.py root@192.168.0.201:/opt/status-monitor/
|
||||
scp -J root@192.168.0.100 deploy.sh root@192.168.0.201:/opt/status-monitor/
|
||||
ssh -J root@192.168.0.100 root@192.168.0.201 "cd /opt/status-monitor && ./deploy.sh"
|
||||
```
|
||||
|
||||
### 2. Verifier en ligne
|
||||
Naviguer vers : https://git.peis.fr/VisualPCI/homelab-config
|
||||
---
|
||||
|
||||
## ✅ 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"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Resume des credentials et acces
|
||||
## 📝 Résumé des actions
|
||||
|
||||
| Systeme | URL/IP | Username | Password/Token | Cle SSH |
|
||||
|---------|--------|----------|---------------|---------|
|
||||
| CT200 | 192.168.0.100 | root | (cle SSH) | id_ed25519 |
|
||||
| CT202 | 192.168.0.202 | root | (cle SSH) | id_ed25519 |
|
||||
| Gitea | git.peis.fr | VisualPCI | 3N14E7GWVSgi3K | - |
|
||||
| Proxmox | 192.168.0.94:8006 | root | (mot de passe) | id_ed25519 |
|
||||
| Action | Statut | Fichier | Priorité |
|
||||
|--------|--------|---------|----------|
|
||||
| Récupérer dynamic.yml depuis CT 200 | ✅ | traefik-config/config/dynamic.yml | **HAUTE** ⭐ |
|
||||
| Récupérer adguard-nginx.conf | ✅ | traefik-config/config/adguard-nginx.conf | Haute |
|
||||
| Récupérer ha-nginx.conf | ✅ | traefik-config/config/ha-nginx.conf | Haute |
|
||||
| Récupérer docker-compose-adguard.yml | ✅ | traefik-config/services/docker-compose-adguard.yml | Haute |
|
||||
| Mettre à jour traefik.yml | ✅ | traefik-config/config/traefik.yml | Moyenne |
|
||||
| Mettre à jour docker-compose.yml | ✅ | traefik-config/docker-compose.yml | Moyenne |
|
||||
| Ajouter git-server à dynamic.yml | ✅ | traefik-config/config/dynamic.yml | **HAUTE** ⭐ |
|
||||
| **Récupérer code status-monitor depuis CT 201** | **🔄** | **status-monitor/*** | **HAUTE** ⭐ |
|
||||
| **Ajouter status-monitor à Git** | **🔄** | **status-monitor/** | **HAUTE** ⭐ |
|
||||
| Supprimer les backups locaux | ⏸️ | .bak, .bak- | Basse |
|
||||
|
||||
> ⭐ **Nouveau** : Le code status-monitor doit être récupéré depuis CT201 et ajouté au dépôt Git
|
||||
|
||||
---
|
||||
|
||||
## Procedures d'urgence
|
||||
## 🎯 Prochaines étapes
|
||||
|
||||
### Si le token Gitea est invalide
|
||||
|
||||
1. Se connecter a Gitea : https://git.peis.fr
|
||||
2. Aller dans : Parametres utilisateur -> Applications -> Tokens d'acces
|
||||
3. Generer un nouveau token avec permissions read:repository et write:repository
|
||||
4. Mettre a jour .netrc sur CT200 :
|
||||
```bash
|
||||
cat > ~/.netrc << 'NETRCEOF'
|
||||
machine git.peis.fr
|
||||
login VisualPCI
|
||||
password NOUVEAU_TOKEN
|
||||
NETRCEOF
|
||||
chmod 600 ~/.netrc
|
||||
```
|
||||
|
||||
### Si CT200 est inaccessible
|
||||
|
||||
1. Verifier le routeur (port forwarding 80/443 vers 192.168.0.100)
|
||||
2. Verifier que CT200 est allume : ping 192.168.0.100
|
||||
3. Verifier Docker sur CT200 : ssh root@192.168.0.100 "docker ps"
|
||||
1. **🔥 Récupérer le code status-monitor depuis CT201** : Utiliser `scp -J root@192.168.0.100 root@192.168.0.201:/opt/status-monitor/*`
|
||||
2. **Pousser le code dans Git** : Ajouter le dossier status-monitor/ au dépôt avec authentification VisualPCI/3N14E7GWVSgi3K
|
||||
3. **Créer un tag v1.1.0** : Pour le versioning du code status-monitor
|
||||
4. **Synchroniser les configurations Traefik** : Les configurations git.peis.fr et status.peis.fr ne sont pas encore dans Git
|
||||
5. **Tester le déploiement** : Après push, déployer sur CT 200 et CT 201 et vérifier tous les services
|
||||
6. **Documenter** : Mettre à jour la documentation avec les nouvelles configurations
|
||||
7. **Nettoyer** : Supprimer les fichiers de backup (.bak, .bak-) après validation
|
||||
|
||||
---
|
||||
|
||||
## Historique des operations
|
||||
**Note** : Les fichiers `acme.json` et `certs/local/*` **ne doivent PAS** être commités dans Git (contiennent des secrets et certificats privés).
|
||||
|
||||
| Date | Operation | Commit | Statut |
|
||||
|------|-----------|--------|--------|
|
||||
| 19/07/2026 | Creation documentation | d9e5e47 | OK |
|
||||
| 19/07/2026 | Ajout AGENT_MAJ | 60ae2e1 | OK |
|
||||
| 19/07/2026 | Mise a jour mode operatoire | - | En cours |
|
||||
**Note Git** : L'authentification se fait avec l'utilisateur `VisualPCI` et le mot de passe `3N14E7GWVSgi3K`. Les connexions SSH utilisent CT200 comme serveur de rebond (bastion) pour accéder à CT201.
|
||||
|
||||
---
|
||||
|
||||
**Note importante** : Les fichiers acme.json et certs/local/* ne doivent PAS etre commits dans Git (contiennent des secrets et certificats prives).
|
||||
|
||||
---
|
||||
|
||||
*Document genere par Mistral Vibe - Mode Operatoire Git valide - 19/07/2026*
|
||||
*Document généré et mis à jour par Mistral Vibe - 19/07/2026*
|
||||
|
||||
Reference in New Issue
Block a user