fix: redis服务改为expose并支持Codex cli的api转发

This commit is contained in:
shaw
2025-08-11 15:54:59 +08:00
parent 3316fb7072
commit ed1f23152d
2 changed files with 40 additions and 6 deletions

View File

@@ -10,7 +10,8 @@ services:
image: weishaw/claude-relay-service:latest image: weishaw/claude-relay-service:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${PORT:-3000}:3000" # 绑定地址:生产环境建议使用反向代理,设置 BIND_HOST=127.0.0.1
- "${BIND_HOST:-0.0.0.0}:${PORT:-3000}:3000"
environment: environment:
# 🌐 服务器配置 # 🌐 服务器配置
- NODE_ENV=production - NODE_ENV=production
@@ -84,8 +85,12 @@ services:
redis: redis:
image: redis:7-alpine image: redis:7-alpine
restart: unless-stopped restart: unless-stopped
ports: # 仅在容器网络内部暴露端口,不映射到主机
- "${REDIS_PORT:-6379}:6379" expose:
- "6379"
# 注意:如需本地调试访问,可取消下行注释(生产环境禁用)
# ports:
# - "127.0.0.1:${REDIS_PORT:-6379}:6379"
volumes: volumes:
- ./redis_data:/data - ./redis_data:/data
command: redis-server --save 60 1 --appendonly yes --appendfsync everysec command: redis-server --save 60 1 --appendonly yes --appendfsync everysec
@@ -102,7 +107,7 @@ services:
image: rediscommander/redis-commander:latest image: rediscommander/redis-commander:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${REDIS_WEB_PORT:-8081}:8081" - "127.0.0.1:${REDIS_WEB_PORT:-8081}:8081"
environment: environment:
- REDIS_HOSTS=local:redis:6379 - REDIS_HOSTS=local:redis:6379
depends_on: depends_on:
@@ -117,7 +122,7 @@ services:
image: prom/prometheus:latest image: prom/prometheus:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${PROMETHEUS_PORT:-9090}:9090" - "127.0.0.1:${PROMETHEUS_PORT:-9090}:9090"
volumes: volumes:
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro - ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus - prometheus_data:/prometheus
@@ -137,7 +142,7 @@ services:
image: grafana/grafana:latest image: grafana/grafana:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${GRAFANA_PORT:-3001}:3000" - "127.0.0.1:${GRAFANA_PORT:-3001}:3000"
environment: environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin123} - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin123}
volumes: volumes:

File diff suppressed because one or more lines are too long