-
Notifications
You must be signed in to change notification settings - Fork 580
fix(docker): migrate single-node compose from host to bridge networking #2952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6ef1089
3c2ba6e
afa63f0
64a9aab
6e024d2
a18bbb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,44 +15,118 @@ | |
| # limitations under the License. | ||
| # | ||
|
|
||
| version: "3" | ||
| name: hugegraph-single | ||
|
|
||
| networks: | ||
| hg-net: | ||
| driver: bridge | ||
|
|
||
| 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" | ||
bitflicker64 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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
|
||
| 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 | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 defaultsUsing
build:together withimage:does not always force a local build. In Compose, the usual behavior (depending onpull_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:
Since
docker/docker-compose.ymlis intended for quickstart usage, I recommend keeping it pull-only by default and movingbuild:blocks to a dev-specific override (for example,docker-compose.dev.yml).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 upThere was a problem hiding this comment.
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.