Initial commit

This commit is contained in:
2020-11-25 15:19:15 +01:00
commit 3178c8fe40
4 changed files with 104 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
conf/acme.json

51
README.md Normal file
View File

@@ -0,0 +1,51 @@
Configuration Traefic.
=====================
Pour démarrer :
---------------
```bash
touch conf/acme.json
chmod 600 conf/acme.json
docker network create web
```
Pour ajouter un service :
-------------------------
Dans le fichier `docker-compose.yml` de ce service , ajouter le réseau `web` :
```yaml
networks:
web:
external: true
backend:
```
Dans ce même fichier sur le service qui va être lié au proxy le connecter au réseau et ajouter les paramètres qui vont bien :
```yaml
version: "3.8"
services:
MonService:
[...]
networks:
- web
- backend
labels:
- traefik.http.routers.host_domaine_tld.rule=Host(`host.domain.tld`)
- traefik.http.routers.host_domaine_tld.tls=true
- traefik.http.routers.host_domaine_tld.tls.certresolver=myresolver
- traefik.http.services.host_domaine_tld.loadbalancer.server.port=80
[...]
```
**Penser à remplacer `host.domaine.tls` et `host_domain_tld` par les valeurs qui vont bien.**
Les services qui ne sont pas publié doivent être ajouté au réseau `backend`.
```yaml
services:
MonService:
[...]
networks:
- backend
[...]
```
Si il n'y a qu'un service, inutile d'ajouter le réseau `backend`

32
conf/traefik.toml Normal file
View File

@@ -0,0 +1,32 @@
[global]
checkNewVersion=true
sendAnonymousUsage=false
[accesslog]
[log]
level = "WARNING"
[api]
insecure = true
dashboard = true
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http]
[entryPoints.web.http.redirections]
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[certificatesResolvers.myresolver.acme]
email = "florestan@bredow.fr"
storage = "acme.json"
[certificatesResolvers.myresolver.acme.httpChallenge]
entryPoint = "web"
[providers.docker]
network = "web"

20
docker-compose.yml Normal file
View File

@@ -0,0 +1,20 @@
version: '3.8'
services:
traefik:
image: traefik:2.3
ports:
- "80:80"
- "443:443"
- "8080:8080"
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./conf/traefik.toml:/etc/traefik/traefik.toml:ro
- ./conf/acme.json:/acme.json
- ./conf/custom:/etc/traefik/custom:ro
networks:
web:
external: true