11# The aim of this docker compose file is to provide a good known
22# way to build your docker-compose file for Anomaly projects
3- #
3+ #
44# This file provides you a template for your development environment
55
66# https://docs.docker.com/compose/compose-file/compose-versioning/
@@ -9,73 +9,9 @@ version: "3.8"
99# These are volumes managed by Docker
1010volumes :
1111 lab_mock :
12- letsencrypt :
1312
14- services :
1513
16- reverse-proxy :
17- container_name : reverse-proxy
18- image : traefik:v3.0
19- # healthcheck:
20- # test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:8080/health"]
21- # interval: 30s
22- # timeout: 10s
23- # retries: 3
24- command :
25- # Remove this for production, this exposes the web UI
26- - " --providers.docker=true"
27- - " --providers.docker.exposedbydefault=false"
28- - " --entrypoints.web.address=:80"
29- - " --entrypoints.http.http.redirections.entryPoint.to=:443"
30- - " --entrypoints.http.http.redirections.entryPoint.scheme=https"
31- - " --entrypoints.http.http.redirections.entrypoint.permanent=true"
32- - " --entrypoints.https.address=:443"
33- # This allows us to use the staging server for development
34- # We could potentially move this to a variable name
35- # - "--certificatesresolvers.letsencrypt.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
36- - " --certificatesResolvers.letsencrypt.acme.email=${SOA_EMAIL}"
37- - " --certificatesResolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
38- - " --certificatesResolvers.letsencrypt.acme.httpChallenge.entrypoint=http"
39- ports :
40- - " 80:80"
41- - " 443:443"
42- labels :
43- - " traefik.enable=true"
44- # Minimum SSL version set to TLS 1.2
45- - " traefik.http.routers.${PROJ_NAME}-root.tls"
46- # The rule host will determine what domain the SSL cert
47- # will be provisioned for
48- - " traefik.http.routers.${PROJ_NAME}-root.rule=Host(`${PROJ_FQDN}`)"
49- - " traefik.http.routers.${PROJ_NAME}-root.tls.certResolver=letsencrypt"
50- - " traefik.tls.options.default.minVersion=VersionTLS12"
51- # Proxy the bucket or another container for the web client
52- - " traefik.http.middlewares.bucket-header.headers.customrequestheaders.host=${BUCKET_FQDN}"
53- # Declare a service to reverer proxy
54- - " traefik.http.services.bucket-service.loadbalancer.server.url=http://${BUCKET_FQDN}"
55- # Declare a router and attach the service to it
56- - " traefik.http.routers.web-client.entrypoints=https"
57- - " traefik.http.routers.web-client.rule=Host(`${PROJ_FQDN}`)"
58- - " traefik.http.routers.web-client.service=bucket-service"
59- - " traefik.http.routers.web-client.middlewares=bucket-header"
60- # Send X-Frame-Options to DENY
61- - " traefik.http.middlewares.testheader.headers.frameDeny=true"
62- # HSTS security headers
63- # the time has been set to one non-leap year
64- - " traefik.http.middlewares.testheader.headers.stsSeconds=315360000"
65- - " traefik.http.middlewares.testheader.headers.stsIncludeSubdomains=true"
66- - " traefik.http.middlewares.testheader.headers.stsPreload=true"
67- # set the hsts header even in http - see if this required
68- - " traefik.http.middlewares.testheader.headers.forceSTSHeader=true"
69- restart : unless-stopped
70- volumes :
71- # This is to expose the docker socker to the reverse proxy
72- # for it to use the docker provider
73- - /var/run/docker.sock:/var/run/docker.sock:ro
74- - letsencrypt:/letsencrypt
75- # The reverse proxy should be the last thing to be started
76- # it depends on the entire stack to be healthy
77- depends_on :
78- - lab_mock
14+ services :
7915
8016 # Mock application
8117 # - In development we read secrets from .env.development
@@ -87,17 +23,6 @@ services:
8723 dockerfile : Dockerfile
8824 env_file :
8925 - .env.development
90- labels :
91- # Explicitly tell Traefik to expose this container
92- - " traefik.enable=true"
93- # Declare a middleware that strips the api prefix, this
94- # is required for FastaPI to mount on the root and for us
95- # to proxy the urls on the /api endpoint
96- - " traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api/"
97- # The router for this container is going to respond to the host
98- # of the project and root level url
99- - " traefik.http.routers.${PROJ_NAME}-api.rule=Host(`${PROJ_FQDN}`) && PathPrefix(`/api/`)"
100- - " traefik.http.routers.${PROJ_NAME}-api.middlewares=strip-api-prefix"
10126 restart : unless-stopped
10227 ports :
10328 # This is to test if the app is working locally
@@ -107,4 +32,4 @@ services:
10732 - ./src/lab_mock:/opt/lab_mock
10833networks :
10934 default :
110- name : ${PROJ_NAME}-network
35+ name : ${PROJ_NAME}-network
0 commit comments