Files
photo-live/.deploy-staging/docker-compose-cn.yml
T
浅念 07761b1b26 fix(app): camera preview distortion — swap sensor W/H for portrait
previewSize 报横向(W>H),竖屏直用会把画面拉扁。交换宽高转纵向比例再
FittedBox cover 铺满(裁切不变形)。397/397 全绿。

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-24 16:07:44 +08:00

115 lines
3.6 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.
# /opt/photo-live/deploy/docker-compose-cn.yml —— 正式环境 cn 栈(2026-09-24)。
# 基于 infra/deploy/docker-compose.cn.yml 改造(同 ov 版偏差登记):
# ① 自管 mysql:8.4 + redis:7(1Panel MySQL 是 5.7.44 不满足基线)
# ② 独立桥网络 photo-net(与机上其它项目隔离)
# ③ web 回环端口 18088(避开 1Panel phpMyAdmin 的 8089 段)
# ④ mysql 内存调优:cn 机仅 3.5G(可用 ~1.4G),关 performance_schema、
# buffer pool 显式 128M(另建 2G swap 兜底,见部署记录)
# cn 侧多两个角色:worker(sharp 图片流水线)+ sync(跨境推送/对账/统计回传)。
# sync 需出网可达:OV_API_URL(https 443)与 DATABASE_URL_OV(47.254.176.10:13306,
# 安全组白名单 cn 出口 IP)。
name: photo-live-cn
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 --performance-schema=OFF --innodb-buffer-pool-size=128M
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: photo_cn
MYSQL_USER: photo_cn
MYSQL_PASSWORD: ${MYSQL_APP_PASSWORD}
volumes:
- mysql-cn-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-cn:
image: ${SERVER_IMAGE}
command: ["api-cn"]
init: true
env_file: .env.production-cn
environment:
PORT: "8080" # 容器内固定;对外经 web 反代
restart: unless-stopped
depends_on:
mysql: { condition: service_healthy }
redis: { condition: service_healthy }
healthcheck:
test: ["CMD", "curl", "-fs", "http://127.0.0.1:8080/v1/health"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
logging: *default-logging
networks: [photo-net]
worker:
image: ${SERVER_IMAGE}
command: ["worker"]
init: true
env_file: .env.production-cn
# 无 HTTP 端口:健康面由 restart 策略 + 日志监控承担(RUNBOOK.md)
restart: unless-stopped
depends_on:
mysql: { condition: service_healthy }
redis: { condition: service_healthy }
logging: *default-logging
networks: [photo-net]
sync:
image: ${SERVER_IMAGE}
command: ["sync"]
init: true
env_file: .env.production-cn
# 需出网:OV_API_URL(443) + DATABASE_URL_OV(13306,待安全组放行)
restart: unless-stopped
depends_on:
mysql: { condition: service_healthy }
redis: { condition: service_healthy }
logging: *default-logging
networks: [photo-net]
web:
image: ${WEB_IMAGE}
init: true
environment:
API_UPSTREAM: http://api-cn:8080 # /v1 反代目标(含 WS /v1/realtime)
ROOT_REDIRECT: /admin/ # cn 根路径直达后台
ports:
- "127.0.0.1:18088:80" # 1Panel OpenResty 反代到此(站点已建)
restart: unless-stopped
depends_on:
api-cn: { 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-cn-data:
networks:
photo-net: { driver: bridge }