Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
conf/acme.json
|
51
README.md
Normal file
51
README.md
Normal 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
32
conf/traefik.toml
Normal 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
20
docker-compose.yml
Normal 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
|
Reference in New Issue
Block a user