infra: update traefik config, remove label-based conf

This commit is contained in:
Marc 2022-12-11 14:39:52 -05:00
parent 3e79b8ee95
commit 9ee8846ec8
Signed by: marc
GPG key ID: 048E042F22B5DC79
6 changed files with 45 additions and 22 deletions

View file

@ -14,15 +14,7 @@ services:
- 6881:6881
- 6881:6881/udp
restart: unless-stopped
labels:
- traefik.http.routers.deluge.rule=Host(`spadinaistan.karnov.club`) && PathPrefix(`/deluge/`)
- traefik.http.routers.deluge.tls=true
- traefik.http.routers.deluge.tls.certresolver=lets-encrypt
- traefik.http.middlewares.deluge-stripprefix.stripprefix.prefixes=/deluge
- traefik.http.routers.deluge.middlewares=deluge-stripprefix,deluge-base-headers
- traefik.http.middlewares.deluge-base-headers.headers.customrequestheaders.X-Deluge-Base=/deluge/
- traefik.http.services.deluge.loadbalancer.server.port=8112
- traefik.enable=true
networks:
default:
name: web

View file

@ -9,12 +9,6 @@ services:
- SPADINAISTAN_ENV=prod
volumes:
- ./src:/app/src
labels:
- traefik.http.routers.monolith.rule=Host(`spadinaistan.karnov.club`) && PathPrefix(`/app/`)
- traefik.http.routers.monolith.tls=true
- traefik.http.routers.monolith.tls.certresolver=lets-encrypt
- traefik.http.services.monolith.loadbalancer.server.port=8000
- traefik.enable=true
networks:
default:

View file

@ -18,7 +18,14 @@ from django.urls import path, include
import identity.urls
urlpatterns = [path("app/", include([
urlpatterns = [
path(
"app/",
include(
[
path("admin/", admin.site.urls),
path("identity/", include(identity.urls.url_patterns)),
]))]
]
),
)
]

View file

@ -2,6 +2,7 @@ import django.http
import django.shortcuts
import django.conf
def identity_check(request: django.http.HttpRequest) -> django.http.HttpResponse:
"""
Verifies if the requesting user is logged in.

View file

@ -1,3 +1,4 @@
[http.routers]
[http.routers.api]
rule = "Host(`spadinaistan.karnov.club`)"
entrypoints = ["websecure"]
@ -6,6 +7,34 @@
[http.routers.api.tls]
certResolver = "lets-encrypt"
[http.routers.deluge]
rule = "Host(`spadinaistan.karnov.club`) && PathPrefix(`/deluge/`)"
service = "deluge"
middlewares = ["deluge-base-headers", "monolith-auth", "deluge-stripprefix"]
[http.routers.deluge.tls]
certResolver = "lets-encrypt"
[http.routers.monolith]
rule = "Host(`spadinaistan.karnov.club`) && PathPrefix(`/app/`)"
service = "monolith"
[http.routers.monolith.tls]
certResolver = "lets-encrypt"
[http.middlewares]
[http.middlewares.monolith-auth.forwardauth]
address = "http://monolith:8000/app/identity/me/"
[http.middlewares.deluge-base-headers.headers.customRequestHeaders]
X-Deluge-Base = "/deluge/"
[http.middlewares.deluge-stripprefix.stripprefix]
prefixes = ["/deluge"]
[http.services]
[http.services.deluge.loadBalancer]
[[http.services.deluge.loadBalancer.servers]]
url = "http://deluge:8112/"
[http.services.monolith.loadBalancer]
[[http.services.monolith.loadBalancer.servers]]
url = "http://monolith:8000/"