Files
deploy.stack/newapi/stack.host.yml
T

45 lines
2.1 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.
# path:: mkdir -pv /data/volumes/newapi/{data,logs}
# pull:: docker compose -p newapi-host --env-file ./newapi/env.host.cfg -f ./newapi/stack.host.yml pull
# run:: docker compose -p newapi-host --env-file ./newapi/env.host.cfg -f ./newapi/stack.host.yml up -d
# disc:: 单容器部署:复用宿主机已有的 Redis 与 PostgreSQL,不启容器依赖
# dist:: 通过 host.docker.internal 访问宿主机服务(Docker 20.10+ 默认支持)
# dist:: 项目名 newapi-host,与 stack.yml 全栈部署互不冲突
# dist:: 宿主机侧需确认:
# dist:: - PG: listen_addresses 允许远程,pg_hba.conf 放通 Docker 网段
# dist:: - Redis: bind 0.0.0.0requirepass 与 REDIS_PASSWORD 一致
# dist:: - 防火墙放通 3000 / 5432 / 6379
# dist:: 第一个注册的账号自动成为管理员;生产务必修改 env.host.cfg 中的全部密码
services:
newapi:
image: ${IMAGE_TAG}
container_name: newapi_app
restart: always
command: --log-dir /app/logs
ports:
- "${PORT:-3000}:3000"
volumes:
- ${Volumes_Path}/data:/data
- ${Volumes_Path}/logs:/app/logs
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
# - SQL_DSN=postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}
# 本机 PG 无 TLS 时显式关闭 SSL:
- SQL_DSN=postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable
- REDIS_CONN_STRING=redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}
- TZ=Asia/Shanghai
- BATCH_UPDATE_ENABLED=true
- ERROR_LOG_ENABLED=true
- NODE_NAME=${NODE_NAME}
- SESSION_SECRET=${SESSION_SECRET}
# 可选:独立日志库(PG 或 ClickHouse),不设则日志与业务同库
# - LOG_SQL_DSN=postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}_log
# 流式无响应超时(秒),默认 120,出现空补全时调大:
# - STREAMING_TIMEOUT=300
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:3000/api/status > / dev/null || exit 1"]
interval: 30s
timeout: 10s
retries: 3