From efbbd480ddc62e695123d31c31d233b0df5155bd Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 13 May 2024 17:26:25 +0100 Subject: After first pre-commit processing --- compose/production/traefik/Dockerfile | 5 +++ compose/production/traefik/traefik.yml | 75 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 compose/production/traefik/Dockerfile create mode 100644 compose/production/traefik/traefik.yml (limited to 'compose/production/traefik') diff --git a/compose/production/traefik/Dockerfile b/compose/production/traefik/Dockerfile new file mode 100644 index 0000000..d54bf27 --- /dev/null +++ b/compose/production/traefik/Dockerfile @@ -0,0 +1,5 @@ +FROM docker.io/traefik:2.11.2 +RUN mkdir -p /etc/traefik/acme \ + && touch /etc/traefik/acme/acme.json \ + && chmod 600 /etc/traefik/acme/acme.json +COPY ./compose/production/traefik/traefik.yml /etc/traefik diff --git a/compose/production/traefik/traefik.yml b/compose/production/traefik/traefik.yml new file mode 100644 index 0000000..4c274d1 --- /dev/null +++ b/compose/production/traefik/traefik.yml @@ -0,0 +1,75 @@ +log: + level: INFO + +entryPoints: + web: + # http + address: ':80' + http: + # https://doc.traefik.io/traefik/routing/entrypoints/#entrypoint + redirections: + entryPoint: + to: web-secure + + web-secure: + # https + address: ':443' + + flower: + address: ':5555' + +certificatesResolvers: + letsencrypt: + # https://doc.traefik.io/traefik/https/acme/#lets-encrypt + acme: + email: 'y@yulqen.org' + storage: /etc/traefik/acme/acme.json + # https://doc.traefik.io/traefik/https/acme/#httpchallenge + httpChallenge: + entryPoint: web + +http: + routers: + web-secure-router: + rule: 'Host(`resources.joannalemon.com`)' + entryPoints: + - web-secure + middlewares: + - csrf + service: django + tls: + # https://doc.traefik.io/traefik/routing/routers/#certresolver + certResolver: letsencrypt + + flower-secure-router: + rule: 'Host(`resources.joannalemon.com`)' + entryPoints: + - flower + service: flower + tls: + # https://doc.traefik.io/traefik/master/routing/routers/#certresolver + certResolver: letsencrypt + + middlewares: + csrf: + # https://doc.traefik.io/traefik/master/middlewares/http/headers/#hostsproxyheaders + # https://docs.djangoproject.com/en/dev/ref/csrf/#ajax + headers: + hostsProxyHeaders: ['X-CSRFToken'] + + services: + django: + loadBalancer: + servers: + - url: http://django:5000 + + flower: + loadBalancer: + servers: + - url: http://flower:5555 + +providers: + # https://doc.traefik.io/traefik/master/providers/file/ + file: + filename: /etc/traefik/traefik.yml + watch: true -- cgit v1.2.3