刘光辉
14 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# 本地开发覆盖(Backlog A 端口收敛后基线只发布 gateway 30000;补丁 #8 追加 config/shared 挂载)。
#
# 用途:
#   1. 宿主侧调试入口:psql/redis-cli/mqadmin/curl 业务端口、引擎契约测试脚本
#   2. 补丁 #8:16 个业务服务只读挂载 ./config/shared:/config/shared:ro,落实
#      config/README.md 与 config/shared/audit-layer0-forms.yaml 里"开发 override 已挂载
#      config/shared,改完重启生效"的承诺——改配置文件后 `docker compose restart <服务>`
#      即生效,不必重建镜像;镜像内 COPY 的同份配置作交付/无挂载场景的自包含兜底
#
# 规则:
#   - 端口全部绑 127.0.0.1,本机可用、不暴露局域网
#   - docker compose 自动合并本文件(无需 -f);**交付包不含本文件**(assemble-offline-package.sh
#     只 cp docker-compose.yml + .env.example),交付环境数据面改配置中心服务名直连
#     (见 docs/release-checklist.md §0),无需这些端口,也不受下方 profiles 门控影响
#   - 需要临时对局域网开放某端口(如手机联调)时,改本文件对应行去掉 127.0.0.1: 前缀
#   - ports/volumes 合并都是数组拼接(非按 key 覆盖):同一服务的同一端口映射/同一挂载点
#     不要在两个文件里重复写,否则 docker 会重复绑定同一宿主端口 / 重复挂载而报错
#   - ⚠️ !override / !reset 需要 docker compose v2.24+
 
# 补丁 #8:单一锚点,16 个业务服务共用,改挂载源只改这一处
x-config-shared-volume: &config-shared-volume
  - ./config/shared:/config/shared:ro
 
# 本机 .env 的 CUSTOMER_DB_HOST/JNPF_REDIS_HOST 已指 CVM(YOUR_DB_HOST:15432 / :16432),
# 栈内 cx-postgres / cx-redis 没有任何消费者。但基线 x-cx 锚点对两者是 service_healthy 强依赖,
# depends_on 会隐式把它们拉起来——白占内存,且 cx/postgres 是 amd64 镜像,本机走 Rosetta 最吃 CPU。
# 故:① profiles 门控让它们不随 up -d 启动;② 清空业务服务的本地数据面依赖。
#
# 回切本机沙盒档(.env 抄 .env.local,坐标改回 cx-postgres:5432)时二选一:
#   docker compose --profile local-db --profile local-redis up -d
#   或 .env 里设 COMPOSE_PROFILES=local-db,local-redis
# PG 数据卷 pgdata 保留未删,拉回即用。docker/preflight.sh 的自愈路径(显式
# `docker compose up -d cx-postgres`)仍有效——显式点名服务会自动激活其 profile。
# (PG/Redis 在 CVM,MQ 已删)。用 !reset 而非 !override 清空,与下方 cx-flow-engine 同款写法。
# ⚠️ 这里必须跟着基线一起改:本锚点是 !override/!reset 语义,会**整体替换**
# docker-compose.yml 里 x-cx 的 depends_on——只改基线不改这里,改动会被这里覆盖回去。
x-no-local-data-plane: &no-local-data-plane
  depends_on: !override {}
 
services:
  cx-postgres:
    profiles: [local-db]
    ports:
      # 本机 Homebrew postgresql@18 占 5432(127.0.0.1 精确绑定优先,L016),沿用 5433
      - "127.0.0.1:5433:5432"
 
  cx-redis:
    profiles: [local-redis]
    ports:
      - "127.0.0.1:6379:6379"
 
  # cx-mq-namesrv / cx-mq-broker 的调试端口发布已随 RocketMQ 一并移除
 
  cx-flow-engine:
    # 引擎库同样在 CVM(FLOW_DB_URL 由 CUSTOMER_DB_HOST/PORT 推导),本地无依赖
    depends_on: !reset {}
    ports:
      # 引擎测试脚本入口(cx-flow-engine/test/*.sh http://127.0.0.1:31000)+ 本地 FlowDomain hairpin
      - "127.0.0.1:31000:31000"
 
  cx-onlyoffice:
    ports:
      # 浏览器直连 DS 载入 api.js 并渲染编辑器(前端 VITE_GLOB_ONLYOFFICE_URL 指向这里)。
      # 与其他调试端口不同,这条是**功能必需**而非仅供调试:DS 的编辑器前端资源由浏览器
      # 直接加载,不经网关。交付环境改为 Nginx 反代 https://<域名>/onlyoffice/(见方案 §8.4)。
      - "127.0.0.1:20000:80"
 
  # 以下业务服务:<<: *no-local-data-plane 清空 depends_on
  # 平台聚合后默认后端为 gateway/platform/biz-common/lims/dms;eln/scheduletask 按 profile 启用。
  # (PG/Redis 在 CVM,MQ 已于 2026-08-10 移除,本地已无任何数据面依赖可等)
  cx-gateway:
    <<: *no-local-data-plane
    volumes: *config-shared-volume
  # 平台聚合服务(2026-08-11):取代原 cx-oauth / cx-system / cx-visualdev / cx-flowable /
  # cx-file / cx-message / cx-permission / cx-visualdata / cx-app 九段。
  # 只发布 30002 一个调试口——九个模块同进程,原来那 8 个端口已无对应监听。
  # 回滚时把下面被注释的九段放回来(与 docker-compose.yml 的注释段一一对应)。
  cx-platform:
    <<: *no-local-data-plane
    ports: ["127.0.0.1:30002:30002"]
    volumes: *config-shared-volume
  # ── 以下九段随平台聚合停用,保留以便回滚 ──
  # cx-oauth:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30001:30001"]
  #   volumes: *config-shared-volume
  # cx-system:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30002:30002"]
  #   volumes: *config-shared-volume
  # cx-visualdev:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30003:30003"]
  #   volumes: *config-shared-volume
  # cx-flowable:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30004:30004"]
  #   volumes: *config-shared-volume
  # cx-file:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30005:30005"]
  #   volumes: *config-shared-volume
  # cx-message:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30008:30008"]
  #   volumes: *config-shared-volume
  # cx-permission:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30010:30010"]
  #   volumes: *config-shared-volume
  cx-lims:
    <<: *no-local-data-plane
    ports: ["127.0.0.1:30019:30019"]
    volumes: *config-shared-volume
  cx-eln:
    <<: *no-local-data-plane
    profiles: ["eln"]
    ports: ["127.0.0.1:30013:30013"]
    volumes: *config-shared-volume
  cx-biz-common:
    <<: *no-local-data-plane
    ports: ["127.0.0.1:30015:30015"]
    volumes: *config-shared-volume
  cx-dms:
    <<: *no-local-data-plane
    ports: ["127.0.0.1:30016:30016"]
    volumes: *config-shared-volume
  # cx-visualdata 随平台聚合停用,保留以便回滚
  # cx-visualdata:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30011:30011"]
  #   volumes: *config-shared-volume
  cx-scheduletask:
    <<: *no-local-data-plane
    ports: ["127.0.0.1:30009:30009"]
    volumes: *config-shared-volume
  # cx-app 随平台聚合停用,保留以便回滚
  # cx-app:
  #   <<: *no-local-data-plane
  #   ports: ["127.0.0.1:30012:30012"]
  #   volumes: *config-shared-volume