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
109 changes: 109 additions & 0 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#
# 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.
#

name: hugegraph-single

networks:
hg-net:
driver: bridge

volumes:
hg-pd-data:
hg-store-data:

services:
pd:
build:
context: ..
dockerfile: hugegraph-pd/Dockerfile
image: hugegraph/pd:${HUGEGRAPH_VERSION:-latest}
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"
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
start_period: 20s

store:
build:
context: ..
dockerfile: hugegraph-store/Dockerfile
image: hugegraph/store:${HUGEGRAPH_VERSION:-latest}
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"
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: 10s
retries: 30
start_period: 30s

server:
build:
context: ..
dockerfile: hugegraph-server/Dockerfile-hstore
image: hugegraph/server:${HUGEGRAPH_VERSION:-latest}
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: 30
start_period: 60s
108 changes: 91 additions & 17 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,118 @@
# limitations under the License.
#

version: "3"
name: hugegraph-single

networks:
hg-net:
driver: bridge

Copy link
Member

@imbajin imbajin Feb 22, 2026

Choose a reason for hiding this comment

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

⚠️ build: in quickstart compose can unexpectedly trigger local source builds — prefer pull-only defaults

Using build: together with image: does not always force a local build. In Compose, the usual behavior (depending on pull_policy) is to try pulling first, then fall back to building if pull is unavailable.

That said, this is still risky for a quickstart file:

  1. If the image/tag cannot be pulled, users unexpectedly need the full source tree and Docker build context.
  2. Startup becomes much slower because services may be built locally.
  3. Locally built images can differ from official release artifacts, reducing reproducibility.

Since docker/docker-compose.yml is intended for quickstart usage, I recommend keeping it pull-only by default and moving build: blocks to a dev-specific override (for example, docker-compose.dev.yml).

Suggested change
pd:
image: hugegraph/pd:${HUGEGRAPH_VERSION:-1.7.0}
container_name: hg-pd
hostname: pd

If local builds are needed for development, users can combine files explicitly, e.g.:
docker compose -f docker/docker-compose.yml -f docker/docker-compose.dev.yml up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve changed the compose setup so it’s pull-only and no longer builds locally. Right now, I’m bind-mounting the updated entrypoint scripts because the current published images don’t include these changes.
Once this PR is done and new images are available, I can remove the mounts. I’ll follow up with a small cleanup PR to switch completely to the official images.

volumes:
hg-pd-data:
hg-store-data:

services:

pd:
image: hugegraph/pd
container_name: pd
image: hugegraph/pd:${HUGEGRAPH_VERSION:-latest}
pull_policy: always
container_name: hg-pd
hostname: pd
network_mode: host
restart: unless-stopped
networks: [hg-net]

entrypoint: ["/hugegraph-pd/docker-entrypoint.sh"]

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"

volumes:
- hg-pd-data:/hugegraph-pd/pd_data
- ../hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh:/hugegraph-pd/docker-entrypoint.sh

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8620"]
test: ["CMD-SHELL", "curl -fsS http://localhost:8620/ >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 3
retries: 12
start_period: 30s


store:
image: hugegraph/store
container_name: store
image: hugegraph/store:${HUGEGRAPH_VERSION:-latest}
pull_policy: always
container_name: hg-store
hostname: store
network_mode: host
restart: unless-stopped
networks: [hg-net]

entrypoint: ["/hugegraph-store/docker-entrypoint.sh"]

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"

volumes:
- hg-store-data:/hugegraph-store/storage
- ../hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh:/hugegraph-store/docker-entrypoint.sh

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8520"]
test: ["CMD-SHELL", "curl -fsS http://localhost:8520/v1/health >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 3
timeout: 10s
retries: 30
start_period: 60s


server:
image: hugegraph/server
container_name: server
image: hugegraph/server:${HUGEGRAPH_VERSION:-latest}
pull_policy: always
container_name: hg-server
Comment on lines 33 to 104
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The container names have been changed from "pd", "store", "server" to "hg-pd", "hg-store", "hg-server". This is a breaking change for users who may reference these containers by name in scripts, monitoring tools, or documentation. While the service names (used for DNS resolution within the Docker network) remain unchanged, external references using docker commands will break. Consider documenting this breaking change in the PR description or release notes, or if backward compatibility is important, keep the original container names.

Copilot uses AI. Check for mistakes.
hostname: server
network_mode: host
restart: unless-stopped
networks: [hg-net]

entrypoint: ["/hugegraph-server/docker-entrypoint.sh"]

depends_on:
store:
condition: service_healthy

environment:
HG_SERVER_BACKEND: hstore
HG_SERVER_PD_PEERS: pd:8686

ports:
- "8080:8080"

volumes:
- ../hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh:/hugegraph-server/docker-entrypoint.sh
- ../hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-storage.sh:/hugegraph-server/bin/wait-storage.sh
- ../hugegraph-server/hugegraph-dist/src/assembly/static/bin/wait-partition.sh:/hugegraph-server/bin/wait-partition.sh

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080"]
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/versions >/dev/null || exit 1"]
interval: 10s
timeout: 5s
retries: 3
retries: 30
start_period: 60s
68 changes: 66 additions & 2 deletions hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,72 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -euo pipefail

# start hugegraph pd
./bin/start-hugegraph-pd.sh -j "$JAVA_OPTS"
log() { echo "[hugegraph-pd-entrypoint] $*"; }

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

migrate_env() {
local old_name="$1" new_name="$2"

if [[ -n "${!old_name:-}" && -z "${!new_name:-}" ]]; then
log "WARN: deprecated env '${old_name}' detected; mapping to '${new_name}'"
export "${new_name}=${!old_name}"
fi
}

migrate_env "GRPC_HOST" "HG_PD_GRPC_HOST"
migrate_env "RAFT_ADDRESS" "HG_PD_RAFT_ADDRESS"
migrate_env "RAFT_PEERS" "HG_PD_RAFT_PEERS_LIST"
migrate_env "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"

: "${HG_PD_GRPC_PORT:=8686}"
: "${HG_PD_REST_PORT:=8620}"
: "${HG_PD_DATA_PATH:=/hugegraph-pd/pd_data}"
: "${HG_PD_INITIAL_STORE_COUNT:=1}"

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}")" ,
"initial-store-count": ${HG_PD_INITIAL_STORE_COUNT} }
}
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.initial-store-count=${HG_PD_INITIAL_STORE_COUNT}"
log " pd.data-path=${HG_PD_DATA_PATH}"

./bin/start-hugegraph-pd.sh -j "${JAVA_OPTS:-}"
tail -f /dev/null
Loading
Loading