From 0c8df9d1756cb86c1dbca09daf4e56dacb6394d7 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Sat, 8 Feb 2025 15:21:55 +0100 Subject: [PATCH] toml > yml --- docker-compose.yml | 2 +- traefik.toml | 59 ------------------------------------ traefik.yml | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 60 deletions(-) delete mode 100644 traefik.toml create mode 100644 traefik.yml diff --git a/docker-compose.yml b/docker-compose.yml index 81dc57f..eae079b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/traefik.toml b/traefik.toml deleted file mode 100644 index df463ac..0000000 --- a/traefik.toml +++ /dev/null @@ -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"] \ No newline at end of file diff --git a/traefik.yml b/traefik.yml new file mode 100644 index 0000000..b9553bc --- /dev/null +++ b/traefik.yml @@ -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" \ No newline at end of file