Add configuration documentation: Caddy, Docker stacks, troubleshooting

This commit is contained in:
2025-12-19 19:06:43 +01:00
parent 6d0c51fb82
commit b5d6f652d5
4 changed files with 199 additions and 0 deletions

58
docs/config/caddy.md Normal file
View File

@@ -0,0 +1,58 @@
# Caddy - Reverse Proxy
## Configuration
Caddy gère le reverse proxy et les certificats SSL internes pour tous les services.
### Principes clés
1. **Domaines .local** : Utilisent Authelia pour l'authentification (réseau local)
2. **Domaines .1871.zt** : Accès ZeroTier sans Authelia (services ont leur propre auth)
3. **Certificats** : Auto-générés par Caddy (CA interne)
### Services sans Authelia
Ces services ont leur propre authentification :
- **Gitea** : OIDC via Authelia
- **Outline** : OIDC via Authelia
- **Linkwarden** : Auth intégrée
- **Vikunja** : Auth intégrée
- **Jellyfin** : Auth intégrée
- **Home Assistant** : Auth intégrée
### Snippet Authelia
```caddyfile
(authelia) {
forward_auth authelia:9091 {
uri /api/authz/forward-auth
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
}
}
```
### WebSocket Support
Pour Home Assistant et Dockge :
```caddyfile
homeassistant.talloires.local {
reverse_proxy homeassistant:8123 {
header_up Host {host}
}
tls internal
}
```
### Problèmes connus
| Problème | Solution |
|----------|----------|
| Safari refuse certificats | Importer CA dans Trousseau macOS |
| 400 Bad Request | Vérifier que le service n'a pas double auth |
| Page blanche | Vérifier WebSocket headers |
### Fichier
`~/docker/caddy/Caddyfile`

View File

@@ -0,0 +1,63 @@
# Docker Stacks
## Organisation
Les services sont organisés en stacks modulaires :
| Stack | Répertoire | Services |
|-------|------------|----------|
| Core | ~/docker/core | Caddy, Authelia, CrowdSec, Portainer, Dockge |
| Monitoring | ~/docker/monitoring | Uptime Kuma, Netdata, Grafana, Loki, Promtail |
| Media | ~/docker/media | Jellyfin, Transmission |
| Productivity | ~/docker/productivity | Gitea, MkDocs, Vikunja, LanguageTool |
| Homelab | ~/docker/homelab | Home Assistant, Watchtower |
| Linkwarden | ~/docker/linkwarden | Linkwarden + PostgreSQL |
| Outline | ~/docker/outline | Outline + PostgreSQL + Redis |
## Réseau
Tous les containers utilisent le réseau externe `talloires_net` :
```yaml
networks:
talloires_net:
external: true
```
## Volumes
### Volumes nommés (préfixés)
Attention lors des migrations : les volumes Docker sont préfixés par le nom du répertoire.
Exemple : `transmission_config` dans `~/docker/talloires` devient `talloires_transmission_config`.
**Solution** : Utiliser `external: true` pour les volumes existants :
```yaml
volumes:
talloires_transmission_config:
external: true
```
### Volumes bind mount
Préférer les bind mounts pour les données importantes :
```yaml
volumes:
- /home/lionel/docker/gitea:/data
```
## Commandes utiles
```bash
# Démarrer un stack
cd ~/docker/media && docker compose up -d
# Voir les logs
docker logs -f jellyfin
# Recréer un container
docker compose up -d --force-recreate jellyfin
```

View File

@@ -0,0 +1,74 @@
# Troubleshooting
## Problèmes connus
### Certificats SSL
**Symptôme** : Safari affiche "Can't establish secure connection"
**Cause** : CA Caddy non trusté par macOS
**Solution** :
```bash
# Exporter le CA
ssh lionel@10.144.221.22 "docker exec caddy cat /data/caddy/pki/authorities/local/root.crt" > ~/Downloads/caddy-root-ca.crt
# Importer dans macOS
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/Downloads/caddy-root-ca.crt
```
### Gitea OAuth "500 Internal Server Error"
**Cause** : URL OAuth pointe vers hostname Docker interne
**Vérifier** :
```bash
docker exec gitea sqlite3 /data/gitea/gitea.db "SELECT cfg FROM login_source WHERE type=6;"
```
**Corriger** :
```bash
docker exec gitea sqlite3 /data/gitea/gitea.db "UPDATE login_source SET cfg = REPLACE(cfg, 'http://authelia:9091', 'https://auth.talloires.local') WHERE type=6;"
docker restart gitea
```
### Container ne trouve pas l'URL externe
**Cause** : Container ne peut pas résoudre ou valider le certificat SSL
**Solution** : Monter le CA Caddy dans le container :
```yaml
volumes:
- /home/lionel/docker/caddy-root-ca.crt:/etc/ssl/certs/caddy-root-ca.crt:ro
environment:
- SSL_CERT_FILE=/etc/ssl/certs/caddy-root-ca.crt
```
### Outline "400 Bad Request"
**Cause** : Double authentification (Authelia + OIDC Outline)
**Solution** : Ne pas utiliser `import authelia` pour Outline dans Caddyfile
### Volumes disparus après migration
**Cause** : Nom du volume change avec le répertoire (préfixe)
**Solution** : Utiliser `external: true` ou lister les volumes existants :
```bash
docker volume ls | grep transmission
```
### Home Assistant page blanche
**Cause** : WebSocket non supporté ou mauvais reverse proxy
**Vérifier** :
```bash
curl -s http://localhost:8123 | head -5
```
**Solution** : Utiliser le nom du container, pas l'IP :
```caddyfile
reverse_proxy homeassistant:8123
```

View File

@@ -23,6 +23,10 @@ nav:
- Vue ensemble: services/overview.md - Vue ensemble: services/overview.md
- Authelia SSO: services/authelia.md - Authelia SSO: services/authelia.md
- Backup: services/backup.md - Backup: services/backup.md
- Configuration:
- Caddy: config/caddy.md
- Docker Stacks: config/docker-stacks.md
- Troubleshooting: config/troubleshooting.md
- Référence: - Référence:
- Ports: reference/ports.md - Ports: reference/ports.md
- Commandes: reference/commands.md - Commandes: reference/commands.md