bitflicker64 commented on code in PR #3149:
URL: https://github.com/apache/hugegraph/pull/3149#discussion_r3767823505


##########
docker/hugegraph-hubble-3x3.properties:
##########
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+server.host=0.0.0.0
+server.port=8088
+
+cluster=hg
+idc=docker
+
+pd.enabled=true
+# Bootstrap target; the live topology comes from PD discovery. If this
+# replica is down when Hubble starts, point it at another server.
+server.direct_url=http://server0:8080
+pd.peers=pd0:8686,pd1:8686,pd2:8686
+# PD REST endpoint for the operations view (single address).
+pd.server=pd0:8620

Review Comment:
   Addressed as an explicit operational limitation in . Hubble's current  
accepts one  value for the operations HTTP calls;  is used for discovery, not 
HTTP failover. The properties file and README now state that  loss blinds the 
operations view and instruct operators to repoint it to a surviving PD. 
Automatic failover would require a separate Hubble code change.



##########
docker/hugegraph-hubble-3x3.properties:
##########
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+server.host=0.0.0.0
+server.port=8088
+
+cluster=hg
+idc=docker
+
+pd.enabled=true
+# Bootstrap target; the live topology comes from PD discovery. If this
+# replica is down when Hubble starts, point it at another server.
+server.direct_url=http://server0:8080

Review Comment:
   Addressed in . The  comment now says it is unused when  and applies only to 
standalone () mode.



##########
docker/docker-compose-hubble.yml:
##########
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Hubble add-on for the distributed cluster defined in
+# docker-compose-3pd-3store-3server.yml. Requires the pre-created cluster
+# network (docker network create hugegraph-net). See "Hubble for the
+# 3-Node Cluster" in docker/README.md for the attach and combined flows.
+
+networks:
+  hg-net:
+    external: true
+    name: ${HUGEGRAPH_NETWORK:-hugegraph-net}
+
+services:
+  hubble:
+    # Pin a release via HUGEGRAPH_VERSION in docker/.env; unset, the image
+    # tag defaults to latest.
+    image: ${HUBBLE_IMAGE:-hugegraph/hubble:${HUGEGRAPH_VERSION:-latest}}
+    pull_policy: ${HUBBLE_PULL_POLICY:-missing}
+    container_name: hg-hubble
+    hostname: hubble
+    restart: unless-stopped
+    networks: [hg-net]
+    ports:
+      - "${HUBBLE_PUBLISH_HOST:-127.0.0.1}:8088:8088"
+    volumes:
+      - 
./hugegraph-hubble-3x3.properties:/hubble/conf/hugegraph-hubble.properties:ro

Review Comment:
   Addressed in . The Hubble add-on now mounts named volumes  and ; CI asserts 
both mounts, and the README documents that H2 state and uploaded files survive 
Hubble recreation.



##########
docker/README.md:
##########
@@ -205,6 +283,110 @@ curl http://localhost:8620/v1/partitions
 
 ---
 
+## Hubble for the 3-Node Cluster
+
+`docker-compose-hubble.yml` defines only the Hubble service. It joins the
+cluster's external network (`hugegraph-net` by default, override with
+`HUGEGRAPH_NETWORK`) and has no `depends_on` on cluster services, so
+starting, stopping, or upgrading Hubble never recreates or restarts PD,
+Store, or Server containers. Hubble reads the cluster topology from
+`hugegraph-hubble-3x3.properties`; adjust that file when attaching to a
+cluster with different hostnames.
+
+Sign in at `http://localhost:8088` as `admin` with the
+`HUGEGRAPH_ADMIN_PASSWORD` from `docker/.env`. Hubble binds to host
+loopback by default (`HUBBLE_PUBLISH_HOST`, same caveats as the
+single-node setup).
+
+The two flows below create Hubble in different Compose projects, so manage
+Hubble with the same flags you started it with: the attach flow always uses
+`-p hugegraph-hubble -f docker-compose-hubble.yml`, the combined flow always
+uses both `-f` flags. The explicit `-p` keeps the attach project independent
+of the directory name and of other Compose projects.
+
+Run one Hubble per host: the single-node stack and both add-on flows all
+publish `127.0.0.1:8088` and name their container `hg-hubble`. The two
+add-on flows are therefore mutually exclusive — starting one while the
+other's Hubble exists fails with a container-name conflict, so `down` the
+flow you are leaving before switching.
+
+### Attach to a running cluster
+
+With the 3-node cluster already up:
+
+```bash
+cd docker
+docker compose -p hugegraph-hubble -f docker-compose-hubble.yml up -d

Review Comment:
   Addressed in . The README now distinguishes attach mode from the combined 
flow, explains that attach requires the existing cluster to already expose the 
new PD-registration/auth settings, and documents the upgrade-first path for 
older clusters.



##########
.github/workflows/server-ci.yml:
##########
@@ -138,6 +138,107 @@ jobs:
           check_compose docker/docker-compose.yml always always
           check_compose docker/docker-compose.dev.yml build missing
 
+          check_cluster_compose() {
+            local cluster="docker/docker-compose-3pd-3store-3server.yml"
+            local addon="docker/docker-compose-hubble.yml"
+            local rendered
+            rendered="$(mktemp)"
+
+            # Both cluster credentials are required and may not be empty.
+            if HUGEGRAPH_AUTH_TOKEN_SECRET=ci-test-secret \
+                 env -u HUGEGRAPH_ADMIN_PASSWORD \
+                 docker compose -f "$cluster" config -q >/dev/null 2>&1; then
+              echo "$cluster accepted an unset admin password" >&2
+              return 1
+            fi
+            if HUGEGRAPH_ADMIN_PASSWORD= \
+                 HUGEGRAPH_AUTH_TOKEN_SECRET=ci-test-secret \
+                 docker compose -f "$cluster" config -q >/dev/null 2>&1; then
+              echo "$cluster accepted an empty admin password" >&2
+              return 1
+            fi
+            if HUGEGRAPH_ADMIN_PASSWORD=ci-test-password \
+                 env -u HUGEGRAPH_AUTH_TOKEN_SECRET \
+                 docker compose -f "$cluster" config -q >/dev/null 2>&1; then
+              echo "$cluster accepted an unset token secret" >&2
+              return 1
+            fi
+            if HUGEGRAPH_ADMIN_PASSWORD=ci-test-password \
+                 HUGEGRAPH_AUTH_TOKEN_SECRET= \
+                 docker compose -f "$cluster" config -q >/dev/null 2>&1; then
+              echo "$cluster accepted an empty token secret" >&2
+              return 1
+            fi
+
+            # The add-on alone must define Hubble and nothing else, join the
+            # shared external network with its default name, and need no
+            # credentials or overrides.
+            env -u HUGEGRAPH_ADMIN_PASSWORD -u HUGEGRAPH_AUTH_TOKEN_SECRET \
+                -u HUGEGRAPH_NETWORK -u HUGEGRAPH_VERSION \
+              docker compose -f "$addon" config --format json > "$rendered"
+            jq -e '
+                (.services | keys) == ["hubble"] and
+                .networks."hg-net".external == true and
+                .networks."hg-net".name == "hugegraph-net" and
+                (.services.hubble | has("depends_on") | not) and
+                any(.services.hubble.volumes[];
+                    .target == "/hubble/conf/hugegraph-hubble.properties" and
+                    (.source | endswith("hugegraph-hubble-3x3.properties")))
+              ' "$rendered" >/dev/null
+
+            # The combined render carries the PD-registration and auth
+            # settings on every server replica and keeps Hubble on loopback.
+            # Rendered with non-default HUGEGRAPH_NETWORK/HUGEGRAPH_VERSION so
+            # CI fails if any file stops honoring the overrides (the add-on
+            # render above covers the defaults).
+            HUGEGRAPH_ADMIN_PASSWORD=ci-test-password \
+            HUGEGRAPH_AUTH_TOKEN_SECRET=ci-test-secret \

Review Comment:
   Addressed in commit . The CI fixture is now  (>=32 bytes), and the cluster 
render uses it for every Server replica. The guard tests still run with ; 
Compose validation is complemented by the repository entrypoint test, so the 
fixture length is checked before rendering.



-- 
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