feat(#91): 生产环境部署方案 - 服务器初始化/Nginx HTTPS/compose生产覆盖/备份策略+文档

This commit is contained in:
bot_dev2
2026-08-11 07:06:42 +08:00
parent 0f382ce2d0
commit 8090a725cd
5 changed files with 217 additions and 0 deletions
@@ -0,0 +1,52 @@
# 生产环境覆盖配置(Issue #91)
# 用法:docker compose -f docker-compose.yml -f deploy/production/docker-compose.override.yml up -d
services:
app:
image: ${REGISTRY:-registry.xayunmei.local}/water-management-system:${IMAGE_TAG:-latest}
restart: always
read_only: true
user: "10001:10001"
tmpfs:
- /tmp
deploy:
resources:
limits:
cpus: "2.0"
memory: 2G
reservations:
memory: 512M
logging:
driver: json-file
options:
max-size: "50m"
max-file: "5"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8000/health"]
interval: 30s
timeout: 5s
retries: 3
ports:
- "127.0.0.1:8000:8000" # 仅绑定回环,由 Nginx 反向代理对外
environment:
- TZ=Asia/Shanghai
- APP_ENV=production
postgres:
restart: always
volumes:
- pgdata:/var/lib/postgresql/data
logging:
driver: json-file
options: { max-size: "20m", max-file: "3" }
nginx:
restart: always
ports:
- "443:443"
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
volumes:
pgdata: