61 lines
1.3 KiB
YAML
61 lines
1.3 KiB
YAML
# 生產環境專用配置
|
||
# 使用方式: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
||
|
||
version: '3.8'
|
||
|
||
services:
|
||
# 在生產環境中擴展 app 服務
|
||
app:
|
||
deploy:
|
||
replicas: 2 # 多個實例提升可用性
|
||
update_config:
|
||
parallelism: 1
|
||
delay: 10s
|
||
restart_policy:
|
||
condition: on-failure
|
||
max_attempts: 3
|
||
restart_policy:
|
||
condition: on-failure
|
||
delay: 5s
|
||
max_attempts: 3
|
||
resources:
|
||
limits:
|
||
cpus: '2.0'
|
||
memory: 2G
|
||
reservations:
|
||
cpus: '1.0'
|
||
memory: 1G
|
||
|
||
# 啟用 Nginx 反向代理
|
||
nginx:
|
||
profiles: [] # 移除 production profile,使其在生產環境中自動啟動
|
||
deploy:
|
||
resources:
|
||
limits:
|
||
cpus: '0.5'
|
||
memory: 512M
|
||
reservations:
|
||
cpus: '0.25'
|
||
memory: 256M
|
||
|
||
# Redis 生產優化
|
||
redis:
|
||
deploy:
|
||
resources:
|
||
limits:
|
||
cpus: '0.5'
|
||
memory: 512M
|
||
reservations:
|
||
cpus: '0.25'
|
||
memory: 256M
|
||
|
||
# OnlyOffice 資源配置
|
||
onlyoffice:
|
||
deploy:
|
||
resources:
|
||
limits:
|
||
cpus: '2.0'
|
||
memory: 4G
|
||
reservations:
|
||
cpus: '1.0'
|
||
memory: 2G |