Files
soul-yongping/soul-api/deploy/docker-compose.bluegreen.yml
Alex-larget 6df1736e1e 1
2026-03-20 14:47:37 +08:00

63 lines
1.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# soul-api 蓝绿部署 - 支持无缝切换
# blue=9001, green=9002部署时先启新实例健康检查通过后切换 Nginx再停旧实例
# 用法:见 deploy.py --mode docker
services:
soul-api-blue:
image: soul-api:latest
container_name: soul-api-blue
restart: "no"
environment:
- REDIS_URL=redis://:soul-docker-redis@redis:6379/0
- GIN_MODE=release
- APP_ENV=production
# 测试/预发布环境可设 SKIP_PROD_SECRET_CHECK=staging正式生产请使用真实密钥并移除此项
- SKIP_PROD_SECRET_CHECK=staging
ports:
- "9001:8080"
volumes:
- soul_uploads:/app/uploads
depends_on:
- redis
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:8080/health"]
interval: 5s
timeout: 5s
retries: 10
start_period: 15s
soul-api-green:
image: soul-api:latest
container_name: soul-api-green
restart: "no"
environment:
- REDIS_URL=redis://:soul-docker-redis@redis:6379/0
- GIN_MODE=release
- APP_ENV=production
- SKIP_PROD_SECRET_CHECK=staging
ports:
- "9002:8080"
volumes:
- soul_uploads:/app/uploads
depends_on:
- redis
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:8080/health"]
interval: 5s
timeout: 5s
retries: 10
start_period: 15s
redis:
# 与 soul-api 一并打包上传,使用本地 DaoCloud 镜像名(与 pack 中 docker save 一致)
image: docker.m.daocloud.io/library/redis:7-alpine
container_name: soul-redis
command: redis-server --appendonly yes --requirepass "soul-docker-redis"
volumes:
- redis_data:/data
restart: unless-stopped
volumes:
redis_data:
soul_uploads: