unis-oa/docker-compose.yml

55 lines
2.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# =============================================================================
# UniSOA 单机部署(docker compose)
# -----------------------------------------------------------------------------
# 先把生产配置放到 ./deploy/config/ 里:
# config.prod.toml 照 backend/config.prod.toml.example 填(库、密钥、Hub、MinIO)
# config.toml 可以不写;要写就只写 [env] name = "prod" 这种覆盖项
# 然后:
# docker compose up -d --build
# docker compose logs -f | head # 看 config: 环境=prod 那行
# docker compose exec unisoa-api python scripts/what_config.py # 自查读的哪几份
#
# 档位开关在这里(OA_ENV);不想用变量就删掉那行,改挂载目录里的 [env] name。
# 配置目录只读挂载:容器改不了宿主上的密钥文件。
# =============================================================================
services:
unisoa-api:
build:
context: .
# 国内网络走镜像源快很多;境外构建把这两行删掉即可(默认是 npmjs / pypi 官方源)
args:
NPM_REGISTRY: https://registry.npmmirror.com
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
image: unisoa:latest
container_name: unisoa-api
environment:
OA_ENV: prod # 用哪一档;对应 /etc/unisoa/config.prod.toml
TZ: Asia/Shanghai # 定时同步与审批超时都按这个时区算
# OA_DB_PASSWORD: "" # 不想把口令写进配置文件就在这里注入(最高优先级)
# OA_JWT_SECRET: ""
# 免登两件套也可以走这里(环境变量压过配置文件与界面),密钥就不落在宿主文件上:
# 三项(站点地址 + 应用编码 + 免登应用密钥)任一途径凑齐免登才开,缺一项回调一律
# 302 回落地页报 SSO_DISABLED;凑齐没有看 GET /api/v1/hub/status 的 sso.missing
# OA_HUB_APP_CODE: "oa"
# OA_HUB_INTEGRATION_KEY: ""
volumes:
- ./deploy/config:/etc/unisoa:ro # 配置目录(密钥只在这儿)
- unisoa-storage:/app/backend/storage # 网盘文件与 MinIO 故障兜底的落盘处
ports:
- "8000:8000"
restart: unless-stopped
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/settings/public', timeout=4)"
interval: 30s
timeout: 5s
retries: 3
start_period: 90s
volumes:
unisoa-storage: