Skip to content

Commit 976ae21

Browse files
committed
feat: starts a label based configuration for traefik
this starts a traefik configuration baesd purely on labels to achieve a secure template for reverse proxies used by anomaly projects, the request follows anomaly/lab-python-server#62 prototype was started in repository for simplicity sake as it has a dummy container based appliation
1 parent 33018ce commit 976ae21

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docker-compose.yml

+42
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,49 @@ volumes:
1111

1212
services:
1313

14+
reverse-proxy:
15+
container_name: reverse-proxy
16+
image: traefik:v3.0
17+
command:
18+
# Remove this for production, this exposes the web UI
19+
- "--api.insecure=true"
20+
- "--providers.docker"
21+
# healthcheck:
22+
# test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:8080/health"]
23+
# interval: 30s
24+
# timeout: 10s
25+
# retries: 3
26+
ports:
27+
# Remove this for production, this is the web UI
28+
- 8080:8080
29+
- 80:80
30+
- 443:443
31+
labels:
32+
# Send X-Frame-Options to DENY
33+
- "traefik.http.middlewares.testheader.headers.frameDeny=true"
34+
# HSTS security headers
35+
# the time has been set to one non-leap year
36+
- "traefik.http.middlewares.testheader.headers.stsSeconds=315360000"
37+
- "traefik.http.middlewares.testheader.headers.stsIncludeSubdomains=true"
38+
- "traefik.http.middlewares.testheader.headers.stsPreload=true"
39+
# set the hsts header even in http - see if this required
40+
- "traefik.http.middlewares.testheader.headers.forceSTSHeader=true"
41+
restart: unless-stopped
42+
volumes:
43+
# This is to expose the docker socker to the reverse proxy
44+
# for it to use the docker provider
45+
- /var/run/docker.sock:/var/run/docker.sock:ro
46+
# The reverse proxy should be the last thing to be started
47+
# it depends on the entire stack to be healthy
48+
depends_on:
49+
- lab_mock
50+
51+
1452
# Mock application
1553
# - In development we read secrets from .env.development
1654
# - Provides a FastAPI based API that runs using uvicorn in development
1755
lab_mock:
56+
container_name: lab_mock
1857
build:
1958
context: .
2059
dockerfile: Dockerfile
@@ -25,3 +64,6 @@ services:
2564
- "8000:80"
2665
volumes:
2766
- ./src/lab_mock:/opt/lab_mock
67+
networks:
68+
default:
69+
name: ${PROJ_NAME}-network

0 commit comments

Comments
 (0)