diff --git a/infra/docker/compose.yml b/infra/docker/compose.yml index 77803efc1..eda34ec78 100644 --- a/infra/docker/compose.yml +++ b/infra/docker/compose.yml @@ -23,6 +23,15 @@ # - 确保 xiaoxia-net 网络已创建: docker network create xiaoxia-net # +# =========================================== +# 日志轮转配置(所有服务共享) +# =========================================== +x-logging: &default-logging + driver: json-file + options: + max-size: "50m" + max-file: "3" + services: # ========================================= # API 服务 @@ -69,6 +78,8 @@ services: retries: 3 start_period: 40s + logging: *default-logging + # ========================================= # 资源限制建议(生产环境建议启用) # ========================================= @@ -107,7 +118,17 @@ services: networks: - xiaoxia-net - + + # 健康检查配置 + healthcheck: + test: ["CMD-SHELL", "celery -A app.celery_app inspect ping --timeout 5 || exit 1"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s + + logging: *default-logging + # ========================================= # 资源限制建议(生产环境建议启用) # ========================================= @@ -155,7 +176,9 @@ services: interval: 30s timeout: 5s retries: 3 - + + logging: *default-logging + # ========================================= # 资源限制建议 # =========================================