infra: update traefik config, remove label-based conf
This commit is contained in:
parent
3e79b8ee95
commit
9ee8846ec8
6 changed files with 45 additions and 22 deletions
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -24,7 +24,7 @@ ALLOWED_HOSTS = ALLOWED_HOSTS_PROD if ENVIRONMENT == "prod" else ALLOWED_HOSTS_D
|
|||
|
||||
BASE_HOST = ALLOWED_HOSTS[0]
|
||||
|
||||
CSRF_TRUSTED_ORIGINS=["https://spadinaistan.karnov.club"]
|
||||
CSRF_TRUSTED_ORIGINS = ["https://spadinaistan.karnov.club"]
|
||||
|
||||
USE_X_FORWARDED_HOST = True
|
||||
|
||||
|
|
|
@ -18,7 +18,14 @@ from django.urls import path, include
|
|||
|
||||
import identity.urls
|
||||
|
||||
urlpatterns = [path("app/", include([
|
||||
path("admin/", admin.site.urls),
|
||||
path("identity/", include(identity.urls.url_patterns)),
|
||||
]))]
|
||||
urlpatterns = [
|
||||
path(
|
||||
"app/",
|
||||
include(
|
||||
[
|
||||
path("admin/", admin.site.urls),
|
||||
path("identity/", include(identity.urls.url_patterns)),
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1,11 +1,40 @@
|
|||
[http.routers.api]
|
||||
[http.routers]
|
||||
[http.routers.api]
|
||||
rule = "Host(`spadinaistan.karnov.club`)"
|
||||
entrypoints = ["websecure"]
|
||||
middlewares = ["monolith-auth"]
|
||||
service = "api@internal"
|
||||
[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.middlewares.monolith-auth.forwardauth]
|
||||
[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/"
|
||||
|
|
Reference in a new issue