File tree Expand file tree Collapse file tree 4 files changed +113
-5
lines changed Expand file tree Collapse file tree 4 files changed +113
-5
lines changed Original file line number Diff line number Diff line change 8585 ]
8686
8787
88+ SECURE_HSTS_SECONDS = 0
89+ SECURE_SSL_REDIRECT : bool = env .bool ("SECURE_SSL_REDIRECT" , False )
90+ SESSION_COOKIE_SECURE : bool = env .bool ("SESSION_COOKIE_SECURE" , True )
91+ CSRF_COOKIE_SECURE : bool = env .bool ("CSRF_COOKIE_SECURE" , True )
92+ CSRF_TRUSTED_ORIGINS : list [str ] = [f"https://{ host } " for host in ALLOWED_HOSTS ]
93+
94+ # Required for HTTP behind Traefik
95+ SECURE_PROXY_SSL_HEADER : tuple = ("HTTP_X_FORWARDED_PROTO" , "http" )
96+ USE_X_FORWARDED_HOST : bool = env .bool ("USE_X_FORWARDED_HOST" , True )
97+
98+
8899ROOT_URLCONF = "core.urls"
89100
90101TEMPLATES = [
Original file line number Diff line number Diff line change 1- version : ' 3.9'
1+ networks :
2+ web :
3+ external : true
24
35services :
46 django :
5- image : ghcr.io/spokanetech/spokanepythonweb:latest
67 container_name : django
8+ image : ghcr.io/spokanetech/spokanepythonweb:latest
79 build :
810 context : ../..
911 dockerfile : src/docker/Dockerfile
1012 env_file :
1113 - ../envs/.env.docker-compose
12- command : ./entrypoint.sh
13- ports :
14- - " 8000:8000"
14+ command : " ./entrypoint.sh"
15+ labels :
16+ - " traefik.enable=true"
17+
18+ # Router for HTTPS
19+ - " traefik.http.routers.django.rule=Host(`davidslusser.website`) || Host(`www.davidslusser.website`)"
20+ - " traefik.http.routers.django.entrypoints=websecure"
21+ - " traefik.http.routers.django.tls.certresolver=myresolver"
22+
23+ # Service settings
24+ - " traefik.http.services.django.loadbalancer.server.port=8000"
25+ networks :
26+ - web
1527 depends_on :
1628 - db
1729 restart : unless-stopped
@@ -25,6 +37,8 @@ services:
2537 - " 5432:5432"
2638 env_file :
2739 - ../envs/.env.docker-compose
40+ networks :
41+ - web
2842 restart : unless-stopped
2943
3044volumes :
Original file line number Diff line number Diff line change 1+ services :
2+ django :
3+ image : ghcr.io/spokanetech/spokanepythonweb:latest
4+ container_name : django
5+ build :
6+ context : ../..
7+ dockerfile : src/docker/Dockerfile
8+ env_file :
9+ - ../envs/.env.docker-compose
10+ command : ./entrypoint.sh
11+ ports :
12+ - " 8000:8000"
13+ depends_on :
14+ - db
15+ restart : unless-stopped
16+
17+ db :
18+ image : postgres:17
19+ container_name : postgres
20+ volumes :
21+ - spokanepython_postgres:/var/lib/postgresql/data
22+ ports :
23+ - " 5432:5432"
24+ env_file :
25+ - ../envs/.env.docker-compose
26+ restart : unless-stopped
27+
28+ volumes :
29+ spokanepython_postgres :
Original file line number Diff line number Diff line change 1+ networks :
2+ web :
3+ external : true
4+
5+ services :
6+ traefik :
7+ image : traefik:v3.0
8+ container_name : traefik
9+ command :
10+ - " --api.dashboard=true"
11+ - " --providers.docker=true"
12+ - " --providers.docker.exposedbydefault=false"
13+
14+ # Entry points
15+ - " --entrypoints.web.address=:80"
16+ - " --entrypoints.websecure.address=:443"
17+
18+ # Redirect HTTP to HTTPS
19+ - " --entrypoints.web.http.redirections.entrypoint.to=websecure"
20+ - " --entrypoints.web.http.redirections.entrypoint.scheme=https"
21+
22+ # Let's Encrypt
23+ - " --certificatesresolvers.myresolver.acme.httpchallenge=true"
24+ - " --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
25+ - " --certificatesresolvers.myresolver.acme.email=admin@davidslusser.website"
26+ - " --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
27+
28+ ports :
29+ - " 80:80"
30+ - " 443:443"
31+ - " 8000:8000"
32+
33+ volumes :
34+ - " /var/run/docker.sock:/var/run/docker.sock:ro"
35+ - " letsencrypt:/letsencrypt"
36+
37+ networks :
38+ - web
39+ restart : unless-stopped
40+
41+ labels :
42+ - " traefik.enable=true"
43+
44+ # Dashboard route
45+ - " traefik.http.routers.traefik.rule=Host(`traefik.davidslusser.website`)"
46+ - " traefik.http.routers.traefik.service=api@internal"
47+ - " traefik.http.routers.traefik.entrypoints=websecure"
48+ - " traefik.http.routers.traefik.tls.certresolver=myresolver"
49+ # Auth middleware for dashboard
50+ - " traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_DASH_AUTH}"
51+ - " traefik.http.routers.traefik.middlewares=traefik-auth"
52+
53+ volumes :
54+ letsencrypt :
You can’t perform that action at this time.
0 commit comments