Skip to content

Commit

Permalink
Updated traefik docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TakenMC committed Nov 19, 2024
1 parent 0a3ad2c commit dbde956
Showing 1 changed file with 17 additions and 46 deletions.
63 changes: 17 additions & 46 deletions docs/traefik.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,6 @@ id: traefik
title: traefik reverse proxy
---

# Traefik static config file

/etc/traefik/traefik.yml
```yaml
api:
dashboard: true
insecure: true

entryPoints:
web:
address: :80
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: :443

certificatesResolvers:
cloudflare:
acme:
email: "youremail"
storage: /etc/traefik/certs/acme.json
caServer: 'https://acme-v02.api.letsencrypt.org/directory'
keyType: EC256
dnsChallenge:
provider: cloudflare
resolvers:
- "1.1.1.1:53"
- "8.8.8.8:53"

providers:
docker:
exposedByDefault: false
endpoint: 'unix:///var/run/docker.sock'
watch: true
allowEmptyServices: true
```
# Traefik docker compose file

```yaml
Expand All @@ -52,12 +12,22 @@ services:
image: traefik:v3.2.0 # or newer version if available
container_name: traefik
restart: unless-stopped
environment:
- CF_DNS_API_TOKEN=${CLOUDFLARE_API_KEY}
command:
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.letsencrypt.acme.email=<youremail>"
- "--certificatesresolvers.letsencrypt.acme.storage=/etc/traefik/certs/acme.json"
- "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.letsencrypt.acme.keytype=EC256"
- "--certificatesresolvers.letsencrypt.acme.dnschallenge.provider=<yourdnsprovider>"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.endpoint=unix:///var/run/docker.sock"
ports:
- "80:80"
- "443:443"
- "8080:8080" # dashboard
networks:
- proxy
volumes:
Expand All @@ -69,9 +39,10 @@ networks:
external: true
```
>Make sure to run `docker network create proxy` before running the above docker compose file.
> Make sure to run `docker network create proxy` before running the above docker compose file.

> Make sure to replace `${CLOUDFLARE_API_KEY}` with your cloudflare api key or follow the [traefik documentaion](https://doc.traefik.io/traefik/) to use a different dns provider.
> Replace `<youremail>` with your email address and `<yourdnsprovider>` with your dns provider.
> You can find the list of supported dns providers [here](https://doc.traefik.io/traefik/https/acme/#providers) as well as the env variabbles needed for each provider.

# Gotfiy docker compose file

Expand All @@ -89,7 +60,7 @@ services:
- "traefik.http.routers.gotify.entrypoints=websecure"
- "traefik.http.routers.gotify.rule=Host(`gotify.yourdomain.tld`)"
- "traefik.http.routers.gotify.tls=true"
- "traefik.http.routers.gotify.tls.certresolver=production"
- "traefik.http.routers.gotify.tls.certresolver=letsencrypt"
- "traefik.http.services.gotify.loadbalancer.server.port=80"
networks:
- proxy
Expand Down

0 comments on commit dbde956

Please sign in to comment.