From f0f88c7f97c86515bd56e5d134fdd2ee8dbcc4bd Mon Sep 17 00:00:00 2001 From: huangzhenpc Date: Thu, 15 Jan 2026 21:17:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8DRedis=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E7=9A=84command=E8=AF=AD=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/docker-compose.yml | 57 +++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index adc1ce17..179d83ca 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -160,29 +160,40 @@ services: # =========================================================================== # Redis Cache (DISABLED - Using external Redis at 172.18.0.2:6379) # =========================================================================== - # To use built-in Redis instead, uncomment the service below and update REDIS_HOST to "redis" - - # redis: - # image: redis:8-alpine - # container_name: sub2api-redis - # restart: unless-stopped - # ulimits: - # nofile: - # soft: 100000 - # hard: 100000 - # volumes: - # - redis_data:/data - # command: redis-server --save 60 1 --appendonly yes --appendfsync everysec - # environment: - # - TZ=${TZ:-Asia/Shanghai} - # networks: - # - sub2api-network - # healthcheck: - # test: ["CMD", "redis-cli", "ping"] - # interval: 10s - # timeout: 5s - # retries: 5 - # start_period: 5s + # Built-in Redis is available but not used by default + # The application connects to external Redis at 172.18.0.2:6379 + redis: + profiles: + - disabled + image: redis:8-alpine + container_name: sub2api-redis + restart: unless-stopped + ulimits: + nofile: + soft: 100000 + hard: 100000 + volumes: + - redis_data:/data + command: + - sh + - -c + - | + redis-server \ + --save 60 1 \ + --appendonly yes \ + --appendfsync everysec \ + $${REDIS_PASSWORD:+--requirepass "$$REDIS_PASSWORD"} + environment: + - TZ=$${TZ:-Asia/Shanghai} + - REDISCLI_AUTH=$${REDIS_PASSWORD:-} + networks: + - sub2api-network + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 5s # ============================================================================= # Volumes