diff --git a/infra/docker/infra.yml b/infra/docker/infra.yml index 13602c7ca..bea79a591 100644 --- a/infra/docker/infra.yml +++ b/infra/docker/infra.yml @@ -1,5 +1,14 @@ version: '3.8' +# =========================================== +# 日志轮转配置(所有服务共享) +# =========================================== +x-logging: &default-logging + driver: json-file + options: + max-size: "50m" + max-file: "3" + services: postgres: image: postgres:16 @@ -10,14 +19,15 @@ services: POSTGRES_USER: xiaoxia POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme_in_production} ports: - - "5432:5432" + - "127.0.0.1:5432:5432" volumes: - postgres_data:/var/lib/postgresql/data networks: - xiaoxia-net + logging: *default-logging healthcheck: test: ["CMD-SHELL", "pg_isready -U xiaoxia"] - interval: 10s + interval: 30s timeout: 5s retries: 5 @@ -26,14 +36,15 @@ services: container_name: xiaoxia-redis restart: always ports: - - "6379:6379" + - "127.0.0.1:6379:6379" volumes: - redis_data:/data networks: - xiaoxia-net + logging: *default-logging healthcheck: test: ["CMD", "redis-cli", "ping"] - interval: 10s + interval: 30s timeout: 3s retries: 5