1
0
forked from noxious/server

toml > yml

This commit is contained in:
Dennis Postma 2025-02-08 15:21:55 +01:00
parent 86cbe3fdcb
commit 0c8df9d175
3 changed files with 75 additions and 60 deletions

View File

@ -50,7 +50,7 @@ services:
- "8080:8080"
volumes:
- traefik_data:/data
- ./traefik.toml:/etc/traefik/traefik.toml
- ./traefik.yml:/etc/traefik/traefik.yml
- /var/run/docker.sock:/var/run/docker.sock:ro
restart: unless-stopped
networks:

View File

@ -1,59 +0,0 @@
[entryPoints]
[entryPoints.web]
address = ":80"
[entryPoints.web.http.redirections.entryPoint]
to = "websecure"
scheme = "https"
[entryPoints.websecure]
address = ":443"
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
exposedByDefault = false
[certificatesResolvers.le.acme]
email = "your-email@example.com"
storage = "/data/acme.json"
[certificatesResolvers.le.acme.tlsChallenge]
[api]
dashboard = true
[ping] # Health check
entryPoint = "websecure"
[http.routers.api]
rule = "PathPrefix(`/api`)"
service = "api"
entryPoints = ["websecure"]
[http.services.api.loadBalancer]
[[http.services.api.loadBalancer.servers]]
url = "http://app:${PORT}"
# Added for websocket
[http.services.app.loadBalancer]
sticky = true
[[http.services.app.loadBalancer.servers]]
url = "http://app:${PORT}"
# Added for websocket
[http.routers.app]
rule = "Host(`${HOST}`)"
entrypoints = ["websecure"]
service = "app"
[http.routers.app.tls]
certresolver = "le"
[http.routers.app.middlewares]
# Enable websockets
- "websocket"
[http.middlewares]
[http.middlewares.websocket.headers]
accessControlAllowHeaders = ["Origin", "Content-Type", "Accept", "Authorization"]
accessControlAllowMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
accessControlAllowOrigin = ["*"]
accessControlExposeHeaders = ["Content-Length", "Content-Range"]

74
traefik.yml Normal file
View File

@ -0,0 +1,74 @@
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: "websecure"
scheme: "https"
websecure:
address: ":443"
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
certificatesResolvers:
le:
acme:
email: "your-email@example.com"
storage: "/data/acme.json"
tlsChallenge: {}
api:
dashboard: true
ping:
entryPoint: "websecure"
http:
routers:
api:
rule: "PathPrefix(`/api`)"
service: "api"
entryPoints: ["websecure"]
app:
rule: "Host(`${HOST}`)"
entryPoints: ["websecure"]
service: "app"
tls:
certResolver: "le"
middlewares:
- "websocket"
services:
api:
loadBalancer:
servers:
- url: "http://app:${PORT}"
app:
loadBalancer:
sticky: true
servers:
- url: "http://app:${PORT}"
middlewares:
websocket:
headers:
accessControlAllowHeaders:
- "Origin"
- "Content-Type"
- "Accept"
- "Authorization"
accessControlAllowMethods:
- "GET"
- "POST"
- "PUT"
- "DELETE"
- "PATCH"
- "OPTIONS"
accessControlAllowOrigin: ["*"]
accessControlExposeHeaders:
- "Content-Length"
- "Content-Range"