imbajin commented on issue #2951:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2951#issuecomment-3904668169

   > Makes sense. Thanks for the clarification and detailed guidance. I will 
review the refactor direction and update my perspective based on the points you 
outlined.
   
   I also use a (basic) PLAN mode with LLM to generate a plan doc:
   ---
   # HugeGraph Docker Compose Refactor Plan
   
   > **Scope**: Replace the current redundant, host-network-coupled Docker 
setup with a
   > maintainable, cross-platform deployment for **Server + PD + Store**.
   
   ---
   
   ## 1. Problem Statement
   
   ### Current Pain Points
   
   | # | Problem               | Detail                                         
                                                  |
   
|---|-----------------------|--------------------------------------------------------------------------------------------------|
   | 1 | Host networking       | `network_mode: host` is Linux-only; breaks on 
Docker Desktop (macOS / Windows)                   |
   | 2 | Config duplication    | `server1-conf / server2-conf / server3-conf`, 
`pd0.yml / pd1.yml / pd2.yml` are near-identical   |
   | 3 | Unclear env contract  | Legacy names (`PD_ADDRESS`, `GRPC_HOST`, 
`RAFT_ADDRESS`) are ambiguous and hard to debug         |
   | 4 | Opaque runtime        | Variable effectiveness is invisible; failures 
surface late instead of fail-fast at startup        |
   
   ---
   
   ## 2. Design Goals
   
   1. **Cross-platform first** — Linux + macOS behave consistently via bridge 
networking.
   2. **Low duplication** — Eliminate static multi-copy config directories.
   3. **Explicit control** — Core network/discovery settings validated at 
startup.
   4. **Readable & debuggable** — Startup logs print all effective key-values.
   5. **CI-friendly** — Config validation and cluster health checks are 
automatable.
   
   ---
   
   ## 3. Architecture Comparison
   
   ### Before → After
   
   ```
     ┌─── BEFORE ─────────────────────┐       ┌─── AFTER 
────────────────────────────┐
     │                                │       │                                 
     │
     │  docker-compose (host net)     │       │  docker-compose (bridge net)    
      │
     │        │                       │       │  + YAML anchors for reuse       
     │
     │        ▼                       │       │        │                        
      │
     │  many static config files      │       │        ▼                        
      │
     │  docker/configs/*              │       │  HG_* env contract              
     │
     │        │                       │       │  (single source of truth)       
      │
     │        ▼                       │       │        │                        
      │
     │  per-node copy model           │       │        ▼                        
      │
     │  pd0/pd1/pd2 yml              │       │  docker-entrypoint mapping       
     │
     │  store0/1/2 yml               │       │  HG_* → real config keys         
     │
     │  server1/2/3 conf             │       │  + required checks               
     │
     │        │                       │       │  + deprecated var hard-fail     
      │
     │        ▼                       │       │        │                        
      │
     │  ⚠ behavior depends on        │       │        ▼                         
     │
     │    host-net semantics          │       │  ✔ predictable runtime          
     │
     │                                │       │  ✔ easy docs / CI / less 
duplication  │
     └────────────────────────────────┘       
└──────────────────────────────────────┘
   ```
   
   ### Configuration Flow
   
   ```
     compose.yaml
       └─▶ environment: HG_*
             └─▶ entrypoint mapping layer
                   └─▶ Spring / hugegraph config keys
                         └─▶ service startup
                               └─▶ health checks
   ```
   
   ---
   
   ## 4. Configuration Contract (v1)
   
   ### 4.1 PD Service (`hugegraph/pd`)
   
   | Env Var                    | Target Key              | Req? | Default      
           |
   
|----------------------------|-------------------------|------|-------------------------|
   | `HG_PD_GRPC_HOST`         | `grpc.host`             | ✔    | —             
          |
   | `HG_PD_GRPC_PORT`         | `grpc.port`             | —    | `8686`        
          |
   | `HG_PD_REST_PORT`         | `server.port`           | —    | `8620`        
          |
   | `HG_PD_RAFT_ADDRESS`      | `raft.address`          | ✔    | —             
          |
   | `HG_PD_RAFT_PEERS_LIST`   | `raft.peers-list`       | ✔    | —             
          |
   | `HG_PD_INITIAL_STORE_LIST`| `pd.initial-store-list` | ✔ ¹  | —             
          |
   | `HG_PD_DATA_PATH`         | `pd.data-path`          | —    | 
`/hugegraph-pd/pd_data` |
   
   > ¹ Required at bootstrap only.
   
   ### 4.2 Store Service (`hugegraph/store`)
   
   | Env Var                | Target Key          | Req? | Default              
        |
   
|------------------------|---------------------|------|------------------------------|
   | `HG_STORE_PD_ADDRESS`  | `pdserver.address`  | ✔    | —                    
        |
   | `HG_STORE_GRPC_HOST`   | `grpc.host`         | ✔    | —                    
        |
   | `HG_STORE_GRPC_PORT`   | `grpc.port`         | —    | `8500`               
        |
   | `HG_STORE_REST_PORT`   | `server.port`       | —    | `8520`               
        |
   | `HG_STORE_RAFT_ADDRESS`| `raft.address`      | ✔    | —                    
        |
   | `HG_STORE_DATA_PATH`   | `app.data-path`     | —    | 
`/hugegraph-store/storage`   |
   
   ### 4.3 Server Service (`hugegraph/server`)
   
   | Env Var              | Target Key            | Req? | Default  |
   |----------------------|-----------------------|------|----------|
   | `HG_SERVER_BACKEND`  | `hugegraph.backend`   | —    | `hstore` |
   | `HG_SERVER_PD_PEERS` | `hugegraph.pd.peers`  | ✔ ²  | —        |
   
   > ² Required when backend is `hstore`.
   
   ### 4.4 Deprecated Variables (hard-fail on detect)
   
   ```
   PD_ADDRESS · GRPC_HOST · RAFT_ADDRESS · RAFT_PEERS · (any undocumented 
legacy alias)
   ```
   
   > **Policy**: If any deprecated variable is detected at startup, the 
entrypoint
   > exits immediately with migration guidance.
   
   ---
   
   ## 5. Reference Compose A — Single Node
   
   **Target file**: `docker/docker-compose.yml`
   
   ```yaml
   version: "3.9"
   name: hugegraph-single
   
   networks:
     hg-net:
       driver: bridge
   
   volumes:
     hg-pd-data:
     hg-store-data:
   
   services:
     pd:
       image: hugegraph/pd:${HUGEGRAPH_VERSION:-1.7.0}
       container_name: hg-pd
       hostname: pd
       restart: unless-stopped
       networks: [hg-net]
       environment:
         HG_PD_GRPC_HOST: pd
         HG_PD_GRPC_PORT: "8686"
         HG_PD_REST_PORT: "8620"
         HG_PD_RAFT_ADDRESS: pd:8610
         HG_PD_RAFT_PEERS_LIST: pd:8610
         HG_PD_INITIAL_STORE_LIST: store:8500
         HG_PD_DATA_PATH: /hugegraph-pd/pd_data
       ports:
         - "8620:8620"
         - "8686:8686"
       volumes:
         - hg-pd-data:/hugegraph-pd/pd_data
       healthcheck:
         test: ["CMD-SHELL", "curl -fsS http://localhost:8620/v1/health 
>/dev/null || exit 1"]
         interval: 10s
         timeout: 5s
         retries: 12
   
     store:
       image: hugegraph/store:${HUGEGRAPH_VERSION:-1.7.0}
       container_name: hg-store
       hostname: store
       restart: unless-stopped
       networks: [hg-net]
       depends_on:
         pd:
           condition: service_healthy
       environment:
         HG_STORE_PD_ADDRESS: pd:8686
         HG_STORE_GRPC_HOST: store
         HG_STORE_GRPC_PORT: "8500"
         HG_STORE_REST_PORT: "8520"
         HG_STORE_RAFT_ADDRESS: store:8510
         HG_STORE_DATA_PATH: /hugegraph-store/storage
       ports:
         - "8520:8520"
         - "8500:8500"
         - "8510:8510"
       volumes:
         - hg-store-data:/hugegraph-store/storage
       healthcheck:
         test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health 
>/dev/null || exit 1"]
         interval: 10s
         timeout: 5s
         retries: 12
   
     server:
       image: hugegraph/server:${HUGEGRAPH_VERSION:-1.7.0}
       container_name: hg-server
       hostname: server
       restart: unless-stopped
       networks: [hg-net]
       depends_on:
         store:
           condition: service_healthy
       environment:
         HG_SERVER_BACKEND: hstore
         HG_SERVER_PD_PEERS: pd:8686
       ports:
         - "8080:8080"
       healthcheck:
         test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions 
>/dev/null || exit 1"]
         interval: 10s
         timeout: 5s
         retries: 20
   ```
   
   ---
   
   ## 6. Reference Compose B — 3 PD + 3 Store + 3 Server
   
   **Target file**: `docker/docker-compose-3pd-3store-3server.yml`
   
   > Uses YAML anchors (`x-*-common`) to eliminate per-node duplication.
   > Only **hostname**, **ports**, and **volumes** differ between instances.
   
   <details>
   <summary>📄 Click to expand full 3×3 compose file</summary>
   
   ```yaml
   version: "3.9"
   name: hugegraph-3x3
   
   # ── Shared service templates ──────────────────────────────────────────
   
   x-pd-common: &pd-common
     image: hugegraph/pd:${HUGEGRAPH_VERSION:-1.7.0}
     restart: unless-stopped
     networks: [hg-net]
     healthcheck:
       test: ["CMD-SHELL", "curl -fsS http://localhost:8620/v1/health 
>/dev/null || exit 1"]
       interval: 10s
       timeout: 5s
       retries: 12
   
   x-store-common: &store-common
     image: hugegraph/store:${HUGEGRAPH_VERSION:-1.7.0}
     restart: unless-stopped
     networks: [hg-net]
     depends_on:
       pd0: { condition: service_healthy }
       pd1: { condition: service_healthy }
       pd2: { condition: service_healthy }
     healthcheck:
       test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health 
>/dev/null || exit 1"]
       interval: 10s
       timeout: 5s
       retries: 15
   
   x-server-common: &server-common
     image: hugegraph/server:${HUGEGRAPH_VERSION:-1.7.0}
     restart: unless-stopped
     networks: [hg-net]
     depends_on:
       store0: { condition: service_healthy }
       store1: { condition: service_healthy }
       store2: { condition: service_healthy }
     environment:
       HG_SERVER_BACKEND: hstore
       HG_SERVER_PD_PEERS: pd0:8686,pd1:8686,pd2:8686
     healthcheck:
       test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null 
|| exit 1"]
       interval: 10s
       timeout: 5s
       retries: 20
   
   # ── Services ──────────────────────────────────────────────────────────
   
   services:
     # --- PD cluster (3 nodes) ---
     pd0:
       <<: *pd-common
       container_name: hg-pd0
       hostname: pd0
       environment:
         HG_PD_GRPC_HOST: pd0
         HG_PD_GRPC_PORT: "8686"
         HG_PD_REST_PORT: "8620"
         HG_PD_RAFT_ADDRESS: pd0:8610
         HG_PD_RAFT_PEERS_LIST: pd0:8610,pd1:8610,pd2:8610
         HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500
         HG_PD_DATA_PATH: /hugegraph-pd/pd_data
       ports: ["8620:8620", "8686:8686"]
       volumes: [hg-pd0-data:/hugegraph-pd/pd_data]
   
     pd1:
       <<: *pd-common
       container_name: hg-pd1
       hostname: pd1
       environment:
         HG_PD_GRPC_HOST: pd1
         HG_PD_GRPC_PORT: "8686"
         HG_PD_REST_PORT: "8620"
         HG_PD_RAFT_ADDRESS: pd1:8610
         HG_PD_RAFT_PEERS_LIST: pd0:8610,pd1:8610,pd2:8610
         HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500
         HG_PD_DATA_PATH: /hugegraph-pd/pd_data
       ports: ["8621:8620", "8687:8686"]
       volumes: [hg-pd1-data:/hugegraph-pd/pd_data]
   
     pd2:
       <<: *pd-common
       container_name: hg-pd2
       hostname: pd2
       environment:
         HG_PD_GRPC_HOST: pd2
         HG_PD_GRPC_PORT: "8686"
         HG_PD_REST_PORT: "8620"
         HG_PD_RAFT_ADDRESS: pd2:8610
         HG_PD_RAFT_PEERS_LIST: pd0:8610,pd1:8610,pd2:8610
         HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500
         HG_PD_DATA_PATH: /hugegraph-pd/pd_data
       ports: ["8622:8620", "8688:8686"]
       volumes: [hg-pd2-data:/hugegraph-pd/pd_data]
   
     # --- Store cluster (3 nodes) ---
     store0:
       <<: *store-common
       container_name: hg-store0
       hostname: store0
       environment:
         HG_STORE_PD_ADDRESS: pd0:8686,pd1:8686,pd2:8686
         HG_STORE_GRPC_HOST: store0
         HG_STORE_GRPC_PORT: "8500"
         HG_STORE_REST_PORT: "8520"
         HG_STORE_RAFT_ADDRESS: store0:8510
         HG_STORE_DATA_PATH: /hugegraph-store/storage
       ports: ["8500:8500", "8510:8510", "8520:8520"]
       volumes: [hg-store0-data:/hugegraph-store/storage]
   
     store1:
       <<: *store-common
       container_name: hg-store1
       hostname: store1
       environment:
         HG_STORE_PD_ADDRESS: pd0:8686,pd1:8686,pd2:8686
         HG_STORE_GRPC_HOST: store1
         HG_STORE_GRPC_PORT: "8500"
         HG_STORE_REST_PORT: "8520"
         HG_STORE_RAFT_ADDRESS: store1:8510
         HG_STORE_DATA_PATH: /hugegraph-store/storage
       ports: ["8501:8500", "8511:8510", "8521:8520"]
       volumes: [hg-store1-data:/hugegraph-store/storage]
   
     store2:
       <<: *store-common
       container_name: hg-store2
       hostname: store2
       environment:
         HG_STORE_PD_ADDRESS: pd0:8686,pd1:8686,pd2:8686
         HG_STORE_GRPC_HOST: store2
         HG_STORE_GRPC_PORT: "8500"
         HG_STORE_REST_PORT: "8520"
         HG_STORE_RAFT_ADDRESS: store2:8510
         HG_STORE_DATA_PATH: /hugegraph-store/storage
       ports: ["8502:8500", "8512:8510", "8522:8520"]
       volumes: [hg-store2-data:/hugegraph-store/storage]
   
     # --- Server cluster (3 nodes) ---
     server0:
       <<: *server-common
       container_name: hg-server0
       hostname: server0
       ports: ["8080:8080"]
   
     server1:
       <<: *server-common
       container_name: hg-server1
       hostname: server1
       ports: ["8081:8080"]
   
     server2:
       <<: *server-common
       container_name: hg-server2
       hostname: server2
       ports: ["8082:8080"]
   
   networks:
     hg-net:
       driver: bridge
   
   volumes:
     hg-pd0-data:
     hg-pd1-data:
     hg-pd2-data:
     hg-store0-data:
     hg-store1-data:
     hg-store2-data:
   ```
   
   </details>
   
   ---
   
   ## 7. Entrypoint Mapping Scripts
   
   Each entrypoint follows the same pattern:
   
   1. **Hard-fail** on deprecated env vars → exit with migration hint
   2. **Require** mandatory vars → fail-fast if missing
   3. **Default** optional vars
   4. **Map** `HG_*` → `SPRING_APPLICATION_JSON` (or properties file for Server)
   5. **Log** all effective config values
   6. **Start** the service
   
   <details>
   <summary>📄 7.1 PD Entrypoint — 
<code>hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh</code></summary>
   
   ```bash
   #!/bin/bash
   set -euo pipefail
   
   log() { echo "[hugegraph-pd-entrypoint] $*"; }
   
   fail_on_deprecated() {
       local old_name="$1" new_name="$2"
       if [[ -n "${!old_name:-}" ]]; then
           echo "ERROR: deprecated env '${old_name}' detected. Use 
'${new_name}' instead." >&2
           exit 2
       fi
   }
   
   require_env() {
       local name="$1"
       if [[ -z "${!name:-}" ]]; then
           echo "ERROR: missing required env '${name}'" >&2; exit 2
       fi
   }
   
   json_escape() {
       local s="$1"
       s=${s//\\/\\\\}; s=${s//\"/\\\"}; s=${s//$'\n'/}
       printf "%s" "$s"
   }
   
   # ── Guard deprecated vars ─────────────────────────────────────────────
   fail_on_deprecated "GRPC_HOST"               "HG_PD_GRPC_HOST"
   fail_on_deprecated "RAFT_ADDRESS"            "HG_PD_RAFT_ADDRESS"
   fail_on_deprecated "RAFT_PEERS"              "HG_PD_RAFT_PEERS_LIST"
   fail_on_deprecated "PD_INITIAL_STORE_LIST"   "HG_PD_INITIAL_STORE_LIST"
   
   # ── Required vars ─────────────────────────────────────────────────────
   require_env "HG_PD_GRPC_HOST"
   require_env "HG_PD_RAFT_ADDRESS"
   require_env "HG_PD_RAFT_PEERS_LIST"
   require_env "HG_PD_INITIAL_STORE_LIST"
   
   # ── Defaults ──────────────────────────────────────────────────────────
   : "${HG_PD_GRPC_PORT:=8686}"
   : "${HG_PD_REST_PORT:=8620}"
   : "${HG_PD_DATA_PATH:=/hugegraph-pd/pd_data}"
   
   # ── Build SPRING_APPLICATION_JSON ─────────────────────────────────────
   SPRING_APPLICATION_JSON="$(cat <<JSON
   {
     "grpc":   { "host": "$(json_escape "${HG_PD_GRPC_HOST}")",
                 "port": "$(json_escape "${HG_PD_GRPC_PORT}")" },
     "server": { "port": "$(json_escape "${HG_PD_REST_PORT}")" },
     "raft":   { "address":    "$(json_escape "${HG_PD_RAFT_ADDRESS}")",
                 "peers-list": "$(json_escape "${HG_PD_RAFT_PEERS_LIST}")" },
     "pd":     { "data-path":          "$(json_escape "${HG_PD_DATA_PATH}")",
                 "initial-store-list": "$(json_escape 
"${HG_PD_INITIAL_STORE_LIST}")" }
   }
   JSON
   )"
   export SPRING_APPLICATION_JSON
   
   log "effective config:"
   log "  grpc.host=${HG_PD_GRPC_HOST}"
   log "  grpc.port=${HG_PD_GRPC_PORT}"
   log "  server.port=${HG_PD_REST_PORT}"
   log "  raft.address=${HG_PD_RAFT_ADDRESS}"
   log "  raft.peers-list=${HG_PD_RAFT_PEERS_LIST}"
   log "  pd.initial-store-list=${HG_PD_INITIAL_STORE_LIST}"
   log "  pd.data-path=${HG_PD_DATA_PATH}"
   
   ./bin/start-hugegraph-pd.sh -j "${JAVA_OPTS:-}"
   tail -f /dev/null
   ```
   
   </details>
   
   <details>
   <summary>📄 7.2 Store Entrypoint — 
<code>hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh</code></summary>
   
   
   ```bash
   #!/bin/bash
   set -euo pipefail
   
   log() { echo "[hugegraph-store-entrypoint] $*"; }
   
   fail_on_deprecated() {
       local old_name="$1" new_name="$2"
       if [[ -n "${!old_name:-}" ]]; then
           echo "ERROR: deprecated env '${old_name}' detected. Use 
'${new_name}' instead." >&2
           exit 2
       fi
   }
   
   require_env() {
       local name="$1"
       if [[ -z "${!name:-}" ]]; then
           echo "ERROR: missing required env '${name}'" >&2; exit 2
       fi
   }
   
   json_escape() {
       local s="$1"
       s=${s//\\/\\\\}; s=${s//\"/\\\"}; s=${s//$'\n'/}
       printf "%s" "$s"
   }
   
   # ── Guard deprecated vars ─────────────────────────────────────────────
   fail_on_deprecated "PD_ADDRESS"   "HG_STORE_PD_ADDRESS"
   fail_on_deprecated "GRPC_HOST"    "HG_STORE_GRPC_HOST"
   fail_on_deprecated "RAFT_ADDRESS" "HG_STORE_RAFT_ADDRESS"
   fail_on_deprecated "RAFT_PEERS"   "HG_PD_RAFT_PEERS_LIST"
   
   # ── Required vars ─────────────────────────────────────────────────────
   require_env "HG_STORE_PD_ADDRESS"
   require_env "HG_STORE_GRPC_HOST"
   require_env "HG_STORE_RAFT_ADDRESS"
   
   # ── Defaults ──────────────────────────────────────────────────────────
   : "${HG_STORE_GRPC_PORT:=8500}"
   : "${HG_STORE_REST_PORT:=8520}"
   : "${HG_STORE_DATA_PATH:=/hugegraph-store/storage}"
   
   # ── Build SPRING_APPLICATION_JSON ─────────────────────────────────────
   SPRING_APPLICATION_JSON="$(cat <<JSON
   {
     "pdserver": { "address": "$(json_escape "${HG_STORE_PD_ADDRESS}")" },
     "grpc":     { "host": "$(json_escape "${HG_STORE_GRPC_HOST}")",
                   "port": "$(json_escape "${HG_STORE_GRPC_PORT}")" },
     "raft":     { "address": "$(json_escape "${HG_STORE_RAFT_ADDRESS}")" },
     "server":   { "port": "$(json_escape "${HG_STORE_REST_PORT}")" },
     "app":      { "data-path": "$(json_escape "${HG_STORE_DATA_PATH}")" }
   }
   JSON
   )"
   export SPRING_APPLICATION_JSON
   
   log "effective config:"
   log "  pdserver.address=${HG_STORE_PD_ADDRESS}"
   log "  grpc.host=${HG_STORE_GRPC_HOST}"
   log "  grpc.port=${HG_STORE_GRPC_PORT}"
   log "  raft.address=${HG_STORE_RAFT_ADDRESS}"
   log "  server.port=${HG_STORE_REST_PORT}"
   log "  app.data-path=${HG_STORE_DATA_PATH}"
   
   ./bin/start-hugegraph-store.sh -j "${JAVA_OPTS:-}"
   tail -f /dev/null
   ```
   
   </details>
   
   <details>
   <summary>📄 7.3 Server Entrypoint — 
<code>hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh</code></summary>
   
   ```bash
   #!/bin/bash
   set -euo pipefail
   
   DOCKER_FOLDER="./docker"
   INIT_FLAG_FILE="init_complete"
   GRAPH_CONF="./conf/graphs/hugegraph.properties"
   
   mkdir -p "${DOCKER_FOLDER}"
   
   log() { echo "[hugegraph-server-entrypoint] $*"; }
   
   fail_on_deprecated() {
       local old_name="$1" new_name="$2"
       if [[ -n "${!old_name:-}" ]]; then
           echo "ERROR: deprecated env '${old_name}' detected. Use 
'${new_name}' instead." >&2
           exit 2
       fi
   }
   
   set_prop() {
       local key="$1" val="$2" file="$3"
       if grep -q -E "^[[:space:]]*${key}[[:space:]]*=" "${file}"; then
           sed -ri "s#^([[:space:]]*${key}[[:space:]]*=).*#\\1${val}#" "${file}"
       else
           echo "${key}=${val}" >> "${file}"
       fi
   }
   
   # ── Guard deprecated vars ─────────────────────────────────────────────
   fail_on_deprecated "BACKEND"  "HG_SERVER_BACKEND"
   fail_on_deprecated "PD_PEERS" "HG_SERVER_PD_PEERS"
   
   # ── Map env → properties file ─────────────────────────────────────────
   [[ -n "${HG_SERVER_BACKEND:-}"  ]] && set_prop "backend"  
"${HG_SERVER_BACKEND}"  "${GRAPH_CONF}"
   [[ -n "${HG_SERVER_PD_PEERS:-}" ]] && set_prop "pd.peers" 
"${HG_SERVER_PD_PEERS}" "${GRAPH_CONF}"
   
   # ── Build wait-storage env ─────────────────────────────────────────────
   WAIT_ENV=()
   [[ -n "${HG_SERVER_BACKEND:-}"  ]] && 
WAIT_ENV+=("hugegraph.backend=${HG_SERVER_BACKEND}")
   [[ -n "${HG_SERVER_PD_PEERS:-}" ]] && 
WAIT_ENV+=("hugegraph.pd.peers=${HG_SERVER_PD_PEERS}")
   
   # ── Init store (once) ─────────────────────────────────────────────────
   if [[ ! -f "${DOCKER_FOLDER}/${INIT_FLAG_FILE}" ]]; then
       if (( ${#WAIT_ENV[@]} > 0 )); then
           env "${WAIT_ENV[@]}" ./bin/wait-storage.sh
       else
           ./bin/wait-storage.sh
       fi
   
       if [[ -z "${PASSWORD:-}" ]]; then
           log "init hugegraph with non-auth mode"
           ./bin/init-store.sh
       else
           log "init hugegraph with auth mode"
           ./bin/enable-auth.sh
           echo "${PASSWORD}" | ./bin/init-store.sh
       fi
       touch "${DOCKER_FOLDER}/${INIT_FLAG_FILE}"
   else
       log "HugeGraph initialization already done. Skipping re-init..."
   fi
   
   ./bin/start-hugegraph.sh -j "${JAVA_OPTS:-}"
   tail -f /dev/null
   ```
   
   </details>
   
   ---
   
   ## 8. Changes Checklist
   
   ### 8.1 Compose Files
   
   - [ ] Replace `network_mode: host` → bridge networking
   - [ ] Add explicit port mappings and health checks
   - [ ] Replace per-node static config mounts → `HG_*` env mappings
   - [ ] Use YAML anchors in 3×3 compose for reusable templates
   
   ### 8.2 Entrypoints
   
   - [ ] Add `HG_* → config key` mapping logic
   - [ ] Add required variable checks (fail-fast)
   - [ ] Add deprecated variable hard-fail
   - [ ] Print effective startup config for troubleshooting
   
   ### 8.3 Documentation Sync
   
   Update these files to remove deprecated env naming:
   
   | File                                       | Lines to update              |
   |--------------------------------------------|------------------------------|
   | `hugegraph-store/README.md`                | L361                         |
   | `hugegraph-store/docs/deployment-guide.md` | L687-689, L726-728, L889-893|
   | `hugegraph-pd/README.md`                   | (if legacy aliases shown)    |
   | Root `README.md` / docker docs             | (if legacy aliases appear)   |
   
   ---
   
   ## 9. Verification Matrix
   
   ### 9.1 Local / Manual
   
   ```bash
   # ── Single-node ──
   docker compose -f docker/docker-compose.yml config
   docker compose -f docker/docker-compose.yml up -d
   
   curl -fsS http://localhost:8620/v1/health   # PD
   curl -fsS http://localhost:8520/v1/health   # Store
   curl -fsS http://localhost:8080/versions    # Server
   
   # ── 3×3 cluster ──
   docker compose -f docker/docker-compose-3pd-3store-3server.yml config
   docker compose -f docker/docker-compose-3pd-3store-3server.yml up -d
   
   # Verify all 9 containers healthy
   # Verify server nodes reach PD cluster via HG_SERVER_PD_PEERS
   ```
   
   ### 9.2 CI Expectations
   
   | Platform | Requirement                                                     
|
   
|----------|-----------------------------------------------------------------|
   | Linux    | Mandatory docker compose smoke checks                           
|
   | macOS    | Mandatory compose smoke checks (if runner supports Docker)      
|
   | Fallback | If macOS Docker runner unavailable: manual gate + publish logs  
 |
   
   ---
   
   ## 10. Migration Notice (PR Template)
   
   ```text
   This PR introduces a strict Docker env contract using HG_* variables.
   
   Legacy variables are REMOVED and no longer supported:
     PD_ADDRESS / GRPC_HOST / RAFT_ADDRESS / RAFT_PEERS
   
   Please migrate to:
     HG_PD_*  ·  HG_STORE_*  ·  HG_SERVER_*
   
   Startup now fails fast if deprecated variables are detected.
   ```
   
   ---
   
   ## 11. Reviewer Checklist
   
   - [ ] Compose files no longer use `network_mode: host`
   - [ ] Core discovery/network keys are set via explicit `HG_*` env vars
   - [ ] Entrypoints hard-fail on deprecated env names
   - [ ] Entrypoints print effective config values before startup
   - [ ] No bulk duplicated conf directories for node-specific overrides
   - [ ] README and deployment guides match the new contract
   - [ ] Linux + macOS verification evidence attached
   
   ---
   
   ## 12. Non-Goals
   
   - Does **not** alter HugeGraph Java public APIs
   - Does **not** redesign cluster semantics or consistency logic
   - Focuses solely on Docker deployment **clarity**, **portability**, and 
**maintainability**
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to