Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
324 changes: 321 additions & 3 deletions .github/workflows/server-ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ For advanced Docker configurations, see:
* [Docker README](./docker/README.md)
* [Server Docker README](hugegraph-server/hugegraph-dist/docker/README.md)

> **Docker Desktop (Mac/Windows)**: The 3-node distributed cluster (`docker/docker-compose-3pd-3store-3server.yml`) uses Docker bridge networking and works on all platforms including Docker Desktop. Allocate at least 12 GB memory to Docker Desktop.
> **Docker Desktop (Mac/Windows)**: The 3-node distributed cluster (`docker/docker-compose-3pd-3store-3server.yml`) joins a pre-created external Docker network shared with the Hubble add-on (see the [Docker README](./docker/README.md) quickstart) and works on all platforms including Docker Desktop. Allocate at least 12 GB memory to Docker Desktop.

> **Note**: Docker images are convenience releases, not **official ASF distribution artifacts**. See [ASF Release Distribution Policy](https://infra.apache.org/release-distribution.html#dockerhub) for details.
>
Expand Down
474 changes: 453 additions & 21 deletions docker/README.md

Large diffs are not rendered by default.

91 changes: 70 additions & 21 deletions docker/docker-compose-3pd-3store-3server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@

name: hugegraph-3x3

# The cluster network is shared with the Hubble add-on
# (docker-compose-hubble.yml), so it is external and must exist first:
# docker network create hugegraph-net
# Set HUGEGRAPH_NETWORK to use a differently named network.
networks:
hg-net:
driver: bridge
external: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ The predictable external network and host-published control-plane ports expose unauthenticated PD/Store administration by default. Evidence: hugegraph-net is external and the file publishes PD/Store REST, gRPC, and Raft ports on all host interfaces; Store has no authentication and PD only checks the internal service username, not the password. Bind these ports to loopback/remove them by default, or require real authentication/TLS and explicit network ACLs before shipping this as the default quickstart.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on the exposure concern. Default loopback binds / ACL+TLS requirements are a cluster-quickstart security redesign; I’d track that as a follow-up so this PR stays reviewable as a Hubble add-on.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c311557.

PD, Store, and Server host ports now bind to 127.0.0.1 by default, so the unauthenticated control plane is not reachable from outside the host. HUGEGRAPH_CONTROL_PLANE_HOST and HUGEGRAPH_SERVER_PUBLISH_HOST widen them, and the README says to do that only behind a network ACL or TLS.

I had asked to defer this as a quickstart redesign. It was not one: the services already talk over hugegraph-net, so nothing needed those host bindings.

Verified live: ss -ltn shows 127.0.0.1:8080, 127.0.0.1:8500, 127.0.0.1:8620.

name: ${HUGEGRAPH_NETWORK:-hugegraph-net}

volumes:
hg-pd0-data:
Expand All @@ -31,8 +36,10 @@ volumes:

# ── Shared service defaults ──────────────────────────────────────────
x-pd-common: &pd-common
# Pin a release via HUGEGRAPH_VERSION in docker/.env; unset, the image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ This auth-required cluster can report healthy while remaining unauthenticated. Evidence: the documented compatible integration is newer than 1.7.x, but the image defaults to floating latest with pull_policy: missing; an already-cached older image can ignore PASSWORD and the token secret, while the healthcheck probes public /versions. Pin or fail closed on incompatible images, or add an authenticated readiness smoke check that proves graph requests are rejected without credentials and succeed with them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree this is a real gap for the auth-required 3-node quickstart. I’d like to keep #3149 scoped to the Hubble add-on and the minimum cluster contract Hubble needs. Changing Server readiness to prove 401/200 and changing default pull policy feels like follow-up cluster hardening rather than the add-on itself. README already documents the manual 401/200 check for incompatible images.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c311557, and you were right that this belonged here rather than in a follow-up.

Both halves of your suggestion are in: all four images now use pull_policy: always, so a stale cached latest is refreshed, and Server readiness no longer probes public /versions. It requires an unauthenticated graph request to return 401 and an authenticated one to return 200. An image that ignores PASSWORD never reports healthy, so up -d --wait fails instead of handing back an open cluster.

Verified on a clean Docker host: 9/9 healthy against latest (1.7.0), 401/200 on all three replicas, wrong password 401.

# tags default to latest. All Compose files here read the same variable.
image: hugegraph/pd:${HUGEGRAPH_VERSION:-latest}
pull_policy: missing
pull_policy: always
restart: unless-stopped
networks: [hg-net]
healthcheck:
Expand All @@ -44,7 +51,7 @@ x-pd-common: &pd-common

x-store-common: &store-common
image: hugegraph/store:${HUGEGRAPH_VERSION:-latest}
pull_policy: missing
pull_policy: always
restart: unless-stopped
networks: [hg-net]
depends_on:
Expand All @@ -58,21 +65,39 @@ x-store-common: &store-common
retries: 40
start_period: 120s

# Shared Server environment; each server node adds its own
# HG_SERVER_REST_URL on top of this map.
x-server-env: &server-env
STORE_REST: store0:8520
HG_SERVER_BACKEND: hstore
HG_SERVER_PD_PEERS: pd0:8686,pd1:8686,pd2:8686
# Register every Server replica with PD under one application name so
# PD-aware clients such as Hubble discover the cluster as one logical
# Server; `hg` matches the Hubble configuration.
HG_SERVER_CLUSTER: hg
HG_SERVER_USE_PD: "true"
HG_SERVER_MIN_FREE_MEMORY: "0"
HG_SERVER_INIT_STORE_ENABLED: "false"
# All replicas must share one token secret so a token issued by any
# server validates on every other server.
HG_SERVER_AUTH_TOKEN_SECRET: ${HUGEGRAPH_AUTH_TOKEN_SECRET:?Set a shared auth token secret}
PASSWORD: ${HUGEGRAPH_ADMIN_PASSWORD:?Set a non-default admin password}

x-server-common: &server-common
image: hugegraph/server:${HUGEGRAPH_VERSION:-latest}
pull_policy: missing
pull_policy: always
restart: unless-stopped
networks: [hg-net]
depends_on:
store0: { condition: service_healthy }
store1: { condition: service_healthy }
store2: { condition: service_healthy }
environment:
STORE_REST: store0:8520
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"]
# Prove the image actually enforces authentication. Older cached images
# may accept PASSWORD but ignore it while still returning healthy on
# /versions, so readiness requires both 401 without credentials and 200
# with the configured admin password.
test: ["CMD-SHELL", "base=$${HG_SERVER_REST_URL}; unauth=$$(curl -s -o /dev/null -w '%{http_code}' \"$${base}/graphs/hugegraph/schema/vertexlabels\"); auth=$$(curl -s -o /dev/null -w '%{http_code}' -u \"admin:$${PASSWORD}\" \"$${base}/graphs/hugegraph/schema/vertexlabels\"); test \"$${unauth}\" = 401 && test \"$${auth}\" = 200"]
interval: 10s
timeout: 5s
retries: 30
Expand All @@ -86,7 +111,6 @@ services:
<<: *pd-common
container_name: hg-pd0
hostname: pd0
networks: [ hg-net ]
environment:
HG_PD_GRPC_HOST: pd0
HG_PD_GRPC_PORT: "8686"
Expand All @@ -96,15 +120,16 @@ services:
HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500
HG_PD_DATA_PATH: /hugegraph-pd/pd_data
HG_PD_INITIAL_STORE_COUNT: 3
ports: ["8620:8620", "8686:8686"]
ports:
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8620:8620"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8686:8686"
volumes:
- hg-pd0-data:/hugegraph-pd/pd_data

pd1:
<<: *pd-common
container_name: hg-pd1
hostname: pd1
networks: [ hg-net ]
environment:
HG_PD_GRPC_HOST: pd1
HG_PD_GRPC_PORT: "8686"
Expand All @@ -114,15 +139,16 @@ services:
HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500
HG_PD_DATA_PATH: /hugegraph-pd/pd_data
HG_PD_INITIAL_STORE_COUNT: 3
ports: ["8621:8620", "8687:8686"]
ports:
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8621:8620"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8687:8686"
volumes:
- hg-pd1-data:/hugegraph-pd/pd_data

pd2:
<<: *pd-common
container_name: hg-pd2
hostname: pd2
networks: [ hg-net ]
environment:
HG_PD_GRPC_HOST: pd2
HG_PD_GRPC_PORT: "8686"
Expand All @@ -132,7 +158,9 @@ services:
HG_PD_INITIAL_STORE_LIST: store0:8500,store1:8500,store2:8500
HG_PD_DATA_PATH: /hugegraph-pd/pd_data
HG_PD_INITIAL_STORE_COUNT: 3
ports: ["8622:8620", "8688:8686"]
ports:
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8622:8620"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8688:8686"
volumes:
- hg-pd2-data:/hugegraph-pd/pd_data

Expand All @@ -148,7 +176,10 @@ services:
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"]
ports:
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8500:8500"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8510:8510"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8520:8520"
volumes:
- hg-store0-data:/hugegraph-store/storage

Expand All @@ -163,7 +194,10 @@ services:
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"]
ports:
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8501:8500"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8511:8510"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8521:8520"
volumes:
- hg-store1-data:/hugegraph-store/storage

Expand All @@ -178,7 +212,10 @@ services:
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"]
ports:
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8502:8500"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8512:8510"
- "${HUGEGRAPH_CONTROL_PLANE_HOST:-127.0.0.1}:8522:8520"
volumes:
- hg-store2-data:/hugegraph-store/storage

Expand All @@ -187,16 +224,28 @@ services:
<<: *server-common
container_name: hg-server0
hostname: server0
ports: ["8080:8080"]
environment:
<<: *server-env
HG_SERVER_REST_URL: ${HUGEGRAPH_SERVER0_REST_URL:-http://server0:8080}
ports:
- "${HUGEGRAPH_SERVER_PUBLISH_HOST:-127.0.0.1}:8080:8080"

server1:
<<: *server-common
container_name: hg-server1
hostname: server1
ports: ["8081:8080"]
environment:
<<: *server-env
HG_SERVER_REST_URL: ${HUGEGRAPH_SERVER1_REST_URL:-http://server1:8080}
ports:
- "${HUGEGRAPH_SERVER_PUBLISH_HOST:-127.0.0.1}:8081:8080"

server2:
<<: *server-common
container_name: hg-server2
hostname: server2
ports: ["8082:8080"]
environment:
<<: *server-env
HG_SERVER_REST_URL: ${HUGEGRAPH_SERVER2_REST_URL:-http://server2:8080}
ports:
- "${HUGEGRAPH_SERVER_PUBLISH_HOST:-127.0.0.1}:8082:8080"
70 changes: 70 additions & 0 deletions docker/docker-compose-3x3.non-auth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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.

# Opt-in override that runs the 3-node cluster WITHOUT authentication.
#
# The default stack authenticates, and that is the configuration to use unless
# you have a reason not to. This override exists for throwaway local trials on
# a trusted network: no admin password, no JWT secret, no login in Hubble.
# Anyone who can reach the published ports can read and modify every graph.
#
# Usage (see "Running without authentication" in README.md):
#
# HUGEGRAPH_ADMIN_PASSWORD=non-auth-placeholder \
# HUGEGRAPH_AUTH_TOKEN_SECRET=non-auth-placeholder \
# docker compose -f docker-compose-3pd-3store-3server.yml \
# -f docker-compose-3x3.non-auth.yml up -d
#
# The two placeholders are required only because Compose interpolates the base
# file's `:?` guards before it applies this override; `!reset` below drops both
# variables, so neither value ever reaches a container. `!reset` needs Docker
# Compose v2.24 or newer.
#
# Pass them inline on this command only. Do not put them in docker/.env. They
# are published values, so they are not credentials, and the token placeholder
# is deliberately shorter than the 32 bytes the Server entrypoint requires: if
# it ever reaches an authenticated Server it aborts startup instead of signing
# tokens with a key that is printed in this repository.

# Each service is spelled out instead of sharing a YAML anchor. `!reset` does
# not survive an anchor/alias reference on every Compose version: on 5.1.2 the
# reset applies only to the anchored service, leaving server1 and server2 with
# a password and token secret, so the cluster would be half authenticated. The
# plain healthcheck override in the same block does propagate, which makes the
# failure easy to miss. Keep these three blocks identical.
services:
server0:
environment:
PASSWORD: !reset null
HG_SERVER_AUTH_TOKEN_SECRET: !reset null
healthcheck:
# The default healthcheck proves the image enforces authentication
# (401 without credentials, 200 with). That check cannot pass here, so
# fall back to probing the bound REST address.
test: ["CMD-SHELL", "curl -fsS $${HG_SERVER_REST_URL}/versions >/dev/null || exit 1"]

server1:
environment:
PASSWORD: !reset null
HG_SERVER_AUTH_TOKEN_SECRET: !reset null
healthcheck:
test: ["CMD-SHELL", "curl -fsS $${HG_SERVER_REST_URL}/versions >/dev/null || exit 1"]

server2:
environment:
PASSWORD: !reset null
HG_SERVER_AUTH_TOKEN_SECRET: !reset null
healthcheck:
test: ["CMD-SHELL", "curl -fsS $${HG_SERVER_REST_URL}/versions >/dev/null || exit 1"]
64 changes: 64 additions & 0 deletions docker/docker-compose-hubble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# 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}

volumes:
hg-hubble-db:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ The two documented Hubble flows do not share these physical volumes. Evidence: attach runs under project hugegraph-hubble, while the combined flow runs under hugegraph-3x3; Compose therefore creates different project-prefixed H2 and upload volumes. Switching flows makes existing state and uploads appear to disappear. Give both volumes stable explicit names (with a multi-cluster override if needed) or document a supported volume migration.

@bitflicker64 bitflicker64 Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll give the Hubble DB/upload volumes explicit stable names so attach and combined share the same physical volumes.

# Explicit names so attach (-p hugegraph-hubble) and combined
# (project hugegraph-3x3) share the same physical volumes.
name: ${HUBBLE_DB_VOLUME:-hugegraph-hubble-db}
hg-hubble-upload-files:
name: ${HUBBLE_UPLOAD_VOLUME:-hugegraph-hubble-upload-files}

services:
hubble:
# Pin a release via HUGEGRAPH_VERSION in docker/.env; unset, the image
# tag defaults to latest. Pull by default so an older cached image cannot
# silently satisfy an auth-sensitive deployment.
image: ${HUBBLE_IMAGE:-hugegraph/hubble:${HUGEGRAPH_VERSION:-latest}}
pull_policy: ${HUBBLE_PULL_POLICY:-always}
container_name: hg-hubble
hostname: hubble
restart: unless-stopped
networks: [hg-net]
ports:
- "${HUBBLE_PUBLISH_HOST:-127.0.0.1}:8088:8088"
environment:
# Image default jdbc:h2:file:./db writes /hubble/db.mv.db, outside
# the /hubble/db volume. Point H2 at a file inside the mount.
SPRING_DATASOURCE_URL: jdbc:h2:file:./db/hubble;DB_CLOSE_ON_EXIT=FALSE
volumes:
# Point HUBBLE_PROPERTIES at the non-auth variant when the cluster runs
# without authentication; see "Running without authentication".
- ${HUBBLE_PROPERTIES:-./hugegraph-hubble-3x3.properties}:/hubble/conf/hugegraph-hubble.properties:ro
- hg-hubble-db:/hubble/db

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

‼️ The H2 database is mounted at the wrong persistence boundary. Evidence: the Hubble image works from /hubble and its datasource is jdbc:h2:file:./db; mounting a volume at /hubble/db leaves the actual /hubble/db.mv.db outside that volume (or makes startup fail because /hubble/db is a directory). Point H2 at a file inside the mounted directory or mount the parent directory, then verify data survives container recreation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll fix the persistence boundary so Hubble state survives recreate.

- hg-hubble-upload-files:/hubble/upload-files
healthcheck:
test: ["CMD-SHELL", "body=$$(curl -fsS http://127.0.0.1:8088/about) && printf '%s' \"$$body\" | grep -q '\"status\":200' && printf '%s' \"$$body\" | grep -q '\"name\":\"hugegraph-hubble\"'"]
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
Loading
Loading