Skip to content

Commit 67825f3

Browse files
committed
fix(logs): add Docker log rotation to prevent disk fill
- Remove unbounded traefik-logs volume and add log rotation to all services (50m × 5 files, compressed). Reduce Traefik verbosity to WARN and filter access logs. - Prevents disk exhaustion while keeping 250MB history per service for debugging. - Fixes: Server disk full from log growth
1 parent 314b319 commit 67825f3

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

docker-compose.prod.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ services:
4242
- ./scripts/traefik/dynamic:/etc/traefik/dynamic:ro
4343
- /var/run/docker.sock:/var/run/docker.sock:ro
4444
- traefik-certs:/letsencrypt
45-
- traefik-logs:/var/log/traefik
4645
networks:
4746
- docsplus-network
4847
labels:
4948
- "traefik.enable=false"
49+
# Docker log rotation
50+
logging:
51+
driver: "json-file"
52+
options:
53+
max-size: "50m"
54+
max-file: "5"
55+
compress: "true"
5056
healthcheck:
5157
test: ["CMD", "traefik", "healthcheck", "--ping"]
5258
interval: 10s
@@ -156,6 +162,12 @@ services:
156162
timeout: 5s
157163
retries: 3
158164
start_period: 20s
165+
logging:
166+
driver: "json-file"
167+
options:
168+
max-size: "50m"
169+
max-file: "5"
170+
compress: "true"
159171
deploy:
160172
replicas: 2
161173
resources:
@@ -233,6 +245,12 @@ services:
233245
timeout: 5s
234246
retries: 3
235247
start_period: 20s
248+
logging:
249+
driver: "json-file"
250+
options:
251+
max-size: "50m"
252+
max-file: "5"
253+
compress: "true"
236254
deploy:
237255
replicas: 2
238256
resources:
@@ -290,6 +308,12 @@ services:
290308
timeout: 5s
291309
retries: 3
292310
start_period: 20s
311+
logging:
312+
driver: "json-file"
313+
options:
314+
max-size: "50m"
315+
max-file: "5"
316+
compress: "true"
293317
deploy:
294318
replicas: 1
295319
resources:
@@ -361,6 +385,12 @@ services:
361385
timeout: 3s
362386
retries: 3
363387
start_period: 30s
388+
logging:
389+
driver: "json-file"
390+
options:
391+
max-size: "50m"
392+
max-file: "5"
393+
compress: "true"
364394
deploy:
365395
replicas: 2
366396
resources:
@@ -377,8 +407,6 @@ services:
377407
volumes:
378408
traefik-certs:
379409
driver: local
380-
traefik-logs:
381-
driver: local
382410
redis-data:
383411
driver: local
384412

0 commit comments

Comments
 (0)