-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
82 lines (72 loc) · 2.06 KB
/
docker-compose.prod.yml
File metadata and controls
82 lines (72 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 生产环境配置
# 使用方式: docker-compose -f docker-compose.prod.yml up -d
services:
queqiao-arr:
build:
context: .
target: production
dockerfile: Dockerfile
container_name: queqiao-arr-prod
image: queqiao-arr:${VERSION:-latest}
ports:
- "${PORT:-8000}:8000"
environment:
# 应用配置
- APP_NAME=${APP_NAME:-Queqiao-arr}
- VERSION=${VERSION:-1.0.0}
- DEBUG=false
# 数据库配置
- DATABASE_URL=sqlite+aiosqlite:///./runtime/data/queqiao.db
# 安全配置(必须在.env中配置)
- SECRET_KEY=${SECRET_KEY:?SECRET_KEY must be set in .env file}
- ACCESS_TOKEN_EXPIRE_MINUTES=${ACCESS_TOKEN_EXPIRE_MINUTES:-30}
# CORS配置(生产环境限制来源)
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-[]}
# 日志配置
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- LOG_FILE=/app/runtime/logs/queqiao-arr.log
- LOG_ROTATION=${LOG_ROTATION:-1 day}
- LOG_RETENTION=${LOG_RETENTION:-30 days}
# 缓存配置
- CACHE_TTL=${CACHE_TTL:-3600}
- TMDB_CACHE_TTL=${TMDB_CACHE_TTL:-86400}
# 请求配置
- REQUEST_TIMEOUT=${REQUEST_TIMEOUT:-30}
- MAX_RETRIES=${MAX_RETRIES:-3}
- RETRY_DELAY=${RETRY_DELAY:-1.0}
volumes:
# 持久化数据(生产环境使用命名卷)
- queqiao-data:/app/runtime/data
- queqiao-logs:/app/runtime/logs
networks:
- queqiao-network
restart: always
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# 资源限制
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
# 安全配置
security_opt:
- no-new-privileges:true
read_only: false
tmpfs:
- /tmp
networks:
queqiao-network:
driver: bridge
volumes:
queqiao-data:
driver: local
queqiao-logs:
driver: local