Files
photo-live/.deploy-staging/docker-compose-ov.yml
T

89 lines
2.9 KiB
YAML
Raw Normal View History

# /opt/photo-live/deploy/docker-compose-ov.yml —— 正式环境 ov 栈(2026-09-24)。
# 基于 infra/deploy/docker-compose-ov.yml 改三点(计划 §2 T0 偏差登记):
# ① 自管 mysql:8.4 + redis:7(1Panel MySQL 是 5.7.44,不满足 8.4/utf8mb4_0900_bin 基线)
# ② 独立桥网络 photo-net(不挂 1panel-network,与机上其它项目隔离)
# ③ web-ov 回环端口 18089(8089 被 1Panel phpMyAdmin 占用)
# ④ mysql 公网映射 13306:cn 侧 sync 跨境直连读库——安全组仅放行 101.37.116.184!
# 同目录配套:.env(SERVER_IMAGE/WEB_IMAGE/MYSQL_ROOT_PASSWORD/MYSQL_APP_PASSWORD)
# 与 .env.production-ov(应用 env,模板=仓库根 .env.production.example-ov)。
name: photo-live-ov
x-logging: &default-logging
driver: json-file
options: { max-size: "10m", max-file: "3" }
services:
mysql:
image: mysql:8.4
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_bin
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: photo_ov
MYSQL_USER: photo_ov
MYSQL_PASSWORD: ${MYSQL_APP_PASSWORD}
ports:
- "0.0.0.0:13306:3306" # 仅安全组白名单 cn IP 可达(阿里云控制台)
volumes:
- mysql-ov-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-p${MYSQL_ROOT_PASSWORD}"]
interval: 5s
retries: 24
restart: unless-stopped
logging: *default-logging
networks: [photo-net]
redis:
image: redis:7-alpine
healthcheck: { test: ["CMD", "redis-cli", "ping"], interval: 5s, retries: 12 }
restart: unless-stopped
logging: *default-logging
networks: [photo-net]
api-ov:
image: ${SERVER_IMAGE}
command: ["api-ov"]
init: true
env_file: .env.production-ov
environment:
PORT_OV: "8081" # main-ov.ts 读 PORT_OV;容器内固定
restart: unless-stopped
depends_on:
mysql: { condition: service_healthy }
redis: { condition: service_healthy }
healthcheck:
test: ["CMD", "curl", "-fs", "http://127.0.0.1:8081/v1/health"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
logging: *default-logging
networks: [photo-net]
web-ov:
image: ${WEB_IMAGE}
init: true
environment:
API_UPSTREAM: http://api-ov:8081 # /v1 反代目标(含 WS /v1/realtime)
ROOT_REDIRECT: /index.html # 观众端安全自指
ports:
- "127.0.0.1:18089:80" # 1Panel OpenResty 反代到此(站点已建)
restart: unless-stopped
depends_on:
api-ov: { condition: service_healthy }
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://127.0.0.1/"]
interval: 30s
timeout: 5s
retries: 5
start_period: 10s
logging: *default-logging
networks: [photo-net]
volumes:
mysql-ov-data:
networks:
photo-net: { driver: bridge }