chore: add Docker log rotation to all production services

- Add json-file log driver with rotation to all 4 services
- Backend/frontend: max-size 50m, max-file 5
- PostgreSQL: max-size 30m, max-file 3
- Redis: max-size 20m, max-file 3
- Prevents disk exhaustion from unbounded container logs
This commit is contained in:
chiguyong 2026-06-04 14:22:33 +08:00
parent 6b90fb5cd6
commit 66e4bff60d
1 changed files with 22 additions and 0 deletions

View File

@ -33,6 +33,11 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 30s start_period: 30s
logging:
driver: json-file
options:
max-size: "30m"
max-file: "3"
deploy: deploy:
resources: resources:
limits: limits:
@ -59,6 +64,11 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
start_period: 15s start_period: 15s
logging:
driver: json-file
options:
max-size: "20m"
max-file: "3"
deploy: deploy:
resources: resources:
limits: limits:
@ -93,6 +103,12 @@ services:
retries: 3 retries: 3
start_period: 30s start_period: 30s
# 使用 Dockerfile 中定义的 gunicorn 启动命令 # 使用 Dockerfile 中定义的 gunicorn 启动命令
logging:
driver: json-file
options:
max-size: "50m"
max-file: "5"
tag: "geo-backend"
deploy: deploy:
resources: resources:
limits: limits:
@ -124,6 +140,12 @@ services:
timeout: 10s timeout: 10s
retries: 3 retries: 3
start_period: 30s start_period: 30s
logging:
driver: json-file
options:
max-size: "50m"
max-file: "5"
tag: "geo-frontend"
deploy: deploy:
resources: resources:
limits: limits: