Skip to content

Commit 1441663

Browse files
committed
refactor: simplify compose files — remove Traefik, adminer, proxy
Simplify docker compose setup to a basic frontend + backend + db stack. Remove all Traefik-related labels, networks, and services.
1 parent 4168d5a commit 1441663

2 files changed

Lines changed: 15 additions & 148 deletions

File tree

compose.override.yml

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,12 @@
11
services:
22

3-
# Local services are available on their ports, but also available on:
4-
# http://api.localhost.tiangolo.com: backend
5-
# http://dashboard.localhost.tiangolo.com: frontend
6-
# etc. To enable it, update .env, set:
7-
# DOMAIN=localhost.tiangolo.com
8-
proxy:
9-
image: traefik:3.6
10-
volumes:
11-
- /var/run/docker.sock:/var/run/docker.sock
12-
ports:
13-
- "80:80"
14-
- "8090:8080"
15-
# Duplicate the command from compose.yml to add --api.insecure=true
16-
command:
17-
# Enable Docker in Traefik, so that it reads labels from Docker services
18-
- --providers.docker
19-
# Add a constraint to only use services with the label for this stack
20-
- --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`)
21-
# Do not expose all Docker services, only the ones explicitly exposed
22-
- --providers.docker.exposedbydefault=false
23-
# Create an entrypoint "http" listening on port 80
24-
- --entrypoints.http.address=:80
25-
# Create an entrypoint "https" listening on port 443
26-
- --entrypoints.https.address=:443
27-
# Enable the access log, with HTTP requests
28-
- --accesslog
29-
# Enable the Traefik log, for configurations and errors
30-
- --log
31-
# Enable debug logging for local development
32-
- --log.level=DEBUG
33-
# Enable the Dashboard and API
34-
- --api
35-
# Enable the Dashboard and API in insecure mode for local development
36-
- --api.insecure=true
37-
labels:
38-
# Enable Traefik for this service, to make it available in the public network
39-
- traefik.enable=true
40-
- traefik.constraint-label=traefik-public
41-
# Dummy https-redirect middleware that doesn't really redirect, only to
42-
# allow running it locally
43-
- traefik.http.middlewares.https-redirect.contenttype.autodetect=false
44-
networks:
45-
- traefik-public
46-
- default
47-
483
db:
494
restart: "no"
505
ports:
516
- "5432:5432"
527

53-
adminer:
8+
prestart:
549
restart: "no"
55-
ports:
56-
- "8080:8080"
5710

5811
backend:
5912
restart: "no"
@@ -62,7 +15,6 @@ services:
6215
build:
6316
context: .
6417
dockerfile: backend/Dockerfile
65-
# command: sleep infinity # Infinite loop to keep container alive doing nothing
6618
command:
6719
- fastapi
6820
- run
@@ -78,7 +30,6 @@ services:
7830
- .venv
7931
- path: ./backend/pyproject.toml
8032
action: rebuild
81-
# TODO: remove once coverage is done locally
8233
volumes:
8334
- ./backend/htmlcov:/app/backend/htmlcov
8435
environment:
@@ -87,12 +38,6 @@ services:
8738
SMTP_TLS: "false"
8839
EMAILS_FROM_EMAIL: "noreply@example.com"
8940

90-
mailcatcher:
91-
image: schickling/mailcatcher
92-
ports:
93-
- "1080:1080"
94-
- "1025:1025"
95-
9641
frontend:
9742
restart: "no"
9843
ports:
@@ -104,6 +49,12 @@ services:
10449
- VITE_API_URL=
10550
- NODE_ENV=development
10651

52+
mailcatcher:
53+
image: schickling/mailcatcher
54+
ports:
55+
- "1080:1080"
56+
- "1025:1025"
57+
10758
playwright:
10859
build:
10960
context: .
@@ -120,7 +71,6 @@ services:
12071
environment:
12172
- VITE_API_URL=http://backend:8000
12273
- MAILCATCHER_HOST=http://mailcatcher:1080
123-
# For the reports when run locally
12474
- PLAYWRIGHT_HTML_HOST=0.0.0.0
12575
- CI=${CI}
12676
volumes:
@@ -129,7 +79,3 @@ services:
12979
ports:
13080
- 9323:9323
13181

132-
networks:
133-
traefik-public:
134-
# For local dev, don't expect an external Traefik network
135-
external: false

compose.yml

Lines changed: 8 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,11 @@ services:
1919
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
2020
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
2121

22-
adminer:
23-
image: adminer
24-
restart: always
25-
networks:
26-
- traefik-public
27-
- default
28-
depends_on:
29-
- db
30-
environment:
31-
- ADMINER_DESIGN=pepa-linha-dark
32-
labels:
33-
- traefik.enable=true
34-
- traefik.docker.network=traefik-public
35-
- traefik.constraint-label=traefik-public
36-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-http.rule=Host(`adminer.${DOMAIN?Variable not set}`)
37-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-http.entrypoints=http
38-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-http.middlewares=https-redirect
39-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-https.rule=Host(`adminer.${DOMAIN?Variable not set}`)
40-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-https.entrypoints=https
41-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-https.tls=true
42-
- traefik.http.routers.${STACK_NAME?Variable not set}-adminer-https.tls.certresolver=le
43-
- traefik.http.services.${STACK_NAME?Variable not set}-adminer.loadbalancer.server.port=8080
44-
4522
prestart:
4623
image: '${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}'
4724
build:
4825
context: .
4926
dockerfile: backend/Dockerfile
50-
networks:
51-
- traefik-public
52-
- default
5327
depends_on:
5428
db:
5529
condition: service_healthy
@@ -58,30 +32,16 @@ services:
5832
env_file:
5933
- .env
6034
environment:
61-
- DOMAIN=${DOMAIN}
62-
- FRONTEND_HOST=${FRONTEND_HOST?Variable not set}
63-
- ENVIRONMENT=${ENVIRONMENT}
64-
- BACKEND_CORS_ORIGINS=${BACKEND_CORS_ORIGINS}
65-
- SECRET_KEY=${SECRET_KEY?Variable not set}
66-
- FIRST_SUPERUSER=${FIRST_SUPERUSER?Variable not set}
67-
- FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD?Variable not set}
68-
- SMTP_HOST=${SMTP_HOST}
69-
- SMTP_USER=${SMTP_USER}
70-
- SMTP_PASSWORD=${SMTP_PASSWORD}
71-
- EMAILS_FROM_EMAIL=${EMAILS_FROM_EMAIL}
7235
- POSTGRES_SERVER=db
7336
- POSTGRES_PORT=${POSTGRES_PORT}
7437
- POSTGRES_DB=${POSTGRES_DB}
7538
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
7639
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
77-
- SENTRY_DSN=${SENTRY_DSN}
40+
- ENVIRONMENT=${ENVIRONMENT}
7841

7942
backend:
8043
image: '${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}'
8144
restart: always
82-
networks:
83-
- traefik-public
84-
- default
8545
depends_on:
8646
db:
8747
condition: service_healthy
@@ -108,67 +68,28 @@ services:
10868
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
10969
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
11070
- SENTRY_DSN=${SENTRY_DSN}
111-
71+
build:
72+
context: .
73+
dockerfile: backend/Dockerfile
11274
healthcheck:
11375
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/utils/health-check/"]
11476
interval: 10s
11577
timeout: 5s
11678
retries: 5
11779

118-
build:
119-
context: .
120-
dockerfile: backend/Dockerfile
121-
labels:
122-
- traefik.enable=true
123-
- traefik.docker.network=traefik-public
124-
- traefik.constraint-label=traefik-public
125-
126-
- traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=8000
127-
128-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=Host(`api.${DOMAIN?Variable not set}`)
129-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.entrypoints=http
130-
131-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.rule=Host(`api.${DOMAIN?Variable not set}`)
132-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.entrypoints=https
133-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.tls=true
134-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-https.tls.certresolver=le
135-
136-
# Enable redirection for HTTP and HTTPS
137-
- traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.middlewares=https-redirect
138-
13980
frontend:
14081
image: '${DOCKER_IMAGE_FRONTEND?Variable not set}:${TAG-latest}'
14182
restart: always
142-
networks:
143-
- traefik-public
144-
- default
83+
depends_on:
84+
backend:
85+
condition: service_healthy
14586
build:
14687
context: .
14788
dockerfile: frontend/Dockerfile
14889
args:
149-
- VITE_API_URL=https://api.${DOMAIN?Variable not set}
90+
- VITE_API_URL=
15091
- NODE_ENV=production
151-
labels:
152-
- traefik.enable=true
153-
- traefik.docker.network=traefik-public
154-
- traefik.constraint-label=traefik-public
155-
156-
- traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=80
157-
158-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=Host(`dashboard.${DOMAIN?Variable not set}`)
159-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.entrypoints=http
160-
161-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.rule=Host(`dashboard.${DOMAIN?Variable not set}`)
162-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.entrypoints=https
163-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.tls=true
164-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-https.tls.certresolver=le
16592

166-
# Enable redirection for HTTP and HTTPS
167-
- traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.middlewares=https-redirect
16893
volumes:
16994
app-db-data:
17095

171-
networks:
172-
traefik-public:
173-
# Allow setting it to false for testing
174-
external: true

0 commit comments

Comments
 (0)