docs: add Traefik reverse proxy examples (labels and file provider) to all READMEs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+51
-1
@@ -147,7 +147,9 @@ docker compose start backend
|
||||
|
||||
### HTTPS
|
||||
|
||||
Cette application ne termine pas TLS. Pour un usage en production, placez-la derrière un reverse proxy gérant HTTPS :
|
||||
Cette application ne termine pas TLS. Pour un usage en production, placez-la derrière un reverse proxy gérant HTTPS.
|
||||
|
||||
#### Nginx
|
||||
|
||||
```nginx
|
||||
server {
|
||||
@@ -167,6 +169,54 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
#### Traefik — Labels Docker
|
||||
|
||||
Ajouter ces labels au service `frontend` et le connecter au réseau partagé avec Traefik :
|
||||
|
||||
```yaml
|
||||
# docker-compose.override.yml
|
||||
services:
|
||||
frontend:
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.inventory.rule=Host(`inventory.example.com`)"
|
||||
- "traefik.http.routers.inventory.entrypoints=websecure"
|
||||
- "traefik.http.routers.inventory.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.inventory.loadbalancer.server.port=8080"
|
||||
networks:
|
||||
- internal
|
||||
- traefik_public # réseau partagé avec votre instance Traefik
|
||||
|
||||
networks:
|
||||
traefik_public:
|
||||
external: true
|
||||
```
|
||||
|
||||
#### Traefik — Configuration dynamique (file provider)
|
||||
|
||||
Si Traefik ne tourne pas dans Docker (ou si vous préférez le file provider), déposez un fichier dans votre répertoire de configuration dynamique :
|
||||
|
||||
```yaml
|
||||
# /etc/traefik/dynamic/inventory.yml
|
||||
http:
|
||||
routers:
|
||||
inventory:
|
||||
rule: "Host(`inventory.example.com`)"
|
||||
entryPoints:
|
||||
- websecure
|
||||
tls:
|
||||
certResolver: letsencrypt
|
||||
service: inventory-svc
|
||||
|
||||
services:
|
||||
inventory-svc:
|
||||
loadBalancer:
|
||||
servers:
|
||||
- url: "http://127.0.0.1:8080"
|
||||
```
|
||||
|
||||
Traefik prend en compte le fichier automatiquement — aucun redémarrage requis.
|
||||
|
||||
Pour un usage local uniquement, lier à la boucle locale pour éviter une exposition LAN accidentelle :
|
||||
|
||||
```yaml
|
||||
|
||||
Reference in New Issue
Block a user