bitflicker64 commented on code in PR #3187:
URL: https://github.com/apache/hugegraph/pull/3187#discussion_r3943255563
##########
docker/test-compose.sh:
##########
@@ -263,6 +291,23 @@ run_render() {
assert_ha "${RENDER_DIR}/ha.json"
assert_dev_override "${RENDER_DIR}/dev.json" \
"${RENDER_DIR}/override.json"
+
+ # An absent host value renders the entrypoint default in every topology,
+ # and a host value overrides it, so the container budget can be aligned
+ # with the healthcheck start period without editing the Compose files.
+ assert_startup_timeout "${RENDER_DIR}/standalone.json" 120 server
+ assert_startup_timeout "${RENDER_DIR}/hstore.json" 120 server
+ assert_startup_timeout "${RENDER_DIR}/ha.json" 120 server0 server1 server2
+ render_with_timeout "${RENDER_DIR}/standalone-timeout.json" 450 \
+ -f "${DOCKER_DIR}/docker-compose.yml"
+ render_with_timeout "${RENDER_DIR}/hstore-timeout.json" 450 \
+ -f "${DOCKER_DIR}/docker-compose-hstore.yml"
+ render_with_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
+ -f
"${DOCKER_DIR}/docker-compose-3pd-3store-3server.yml"
+ assert_startup_timeout "${RENDER_DIR}/standalone-timeout.json" 450 server
+ assert_startup_timeout "${RENDER_DIR}/hstore-timeout.json" 450 server
+ assert_startup_timeout "${RENDER_DIR}/ha-timeout.json" 450 \
+ server0 server1 server2
Review Comment:
Fixed in f2c6a1ff4, taking the suggestion. Confirmed the blind spot first:
rewriting all three Compose files to `${HG_SERVER_STARTUP_TIMEOUT_S:-120}` left
the whole suite green, and an empty host value rendered `"120"` there against
`""` here.
All three topologies are now rendered with an empty value and asserted to
carry one. Verified the assertion fails the `:-` rewrite with exactly `expected
server HG_SERVER_STARTUP_TIMEOUT_S= in .../standalone-empty.json`.
##########
docker/docker-compose.yml:
##########
@@ -34,6 +34,10 @@ services:
PASSWORD: ${HUGEGRAPH_ADMIN_PASSWORD:-}
HG_SERVER_AUTH_TOKEN_SECRET: ${HUGEGRAPH_AUTH_TOKEN_SECRET:-}
HG_SERVER_MIN_FREE_MEMORY: "0"
+ # Unset-only default: a host value overrides it, an absent one
+ # renders the entrypoint default. ":-" would turn an empty host
+ # value into 120 silently, which the entrypoint rejects on purpose.
+ HG_SERVER_STARTUP_TIMEOUT_S: ${HG_SERVER_STARTUP_TIMEOUT_S-120}
Review Comment:
Fixed in f2c6a1ff4. The comment now says the knob aligns the two budgets
downward only: lowering the container budget to meet the health budget needs no
file edit, raising it past that budget does, because the health values are
literals giving every Server about 360 seconds and the documented `up -d
--wait` gives up there.
Checked the rendered values rather than the source lines: `interval: 10s`,
`retries: 30`, `start_period: 60s` on the Server of all three topologies.
Section 7 keeps the reader-facing version, and `docker/README.md` now carries
it too. Agreed that interpolating the health budget belongs in a follow-up
issue rather than here.
##########
docker/test-compose.sh:
##########
@@ -43,6 +44,33 @@ render() {
compose_auth "$@" config --format json > "${output}"
}
+# Same render with an explicit host value, to prove the variable reaches the
+# Server environment rather than only defaulting there.
+render_with_timeout() {
+ local output="$1" timeout="$2"
+ shift 2
+ env HG_SERVER_STARTUP_TIMEOUT_S="${timeout}" \
Review Comment:
Fixed in f2c6a1ff4, taking the suggestion. `STARTUP_TIMEOUT_ENV` is the only
thing the two renders differ by, and `render_with_timeout` rebinds it in a
subshell.
Verified the drift it prevents: adding a variable to `compose_auth` alone
and asserting on the rendered Server environment now reports `true` for the
baseline, the override and the empty render alike. Under the duplicated version
the latter two would have missed it, which is the #3189 case you describe.
##########
docker/docker-compose-hstore.yml:
##########
@@ -92,6 +92,7 @@ services:
HG_SERVER_REST_URL: http://server:8080
HG_SERVER_MIN_FREE_MEMORY: "0"
HG_SERVER_INIT_STORE_ENABLED: "false"
+ HG_SERVER_STARTUP_TIMEOUT_S: ${HG_SERVER_STARTUP_TIMEOUT_S-120}
Review Comment:
Fixed in f2c6a1ff4. Both files now carry the same two-line note as the
standalone file, at their own indent, so the missing colon does not read as a
typo beside `HG_SERVER_AUTH_TOKEN_SECRET: ${HUGEGRAPH_AUTH_TOKEN_SECRET:-}`.
##########
hugegraph-server/hugegraph-dist/docker/README.md:
##########
@@ -144,3 +144,35 @@ native `HEALTHCHECK` instructions. `docker ps` shows real
health status:
| `hugegraph/hugegraph-store` | `GET /v1/health` on port 8520 |
The entrypoints supervise the Java process directly — when Java exits, the
container exits. If started with a restart policy (the provided compose files
use `restart: unless-stopped`), Docker will bring it back automatically. The
old cron-based monitor (`-m true`) is for VM/bare-metal deployments only and is
not used in Docker images.
+
+## 7. Server Startup Timeout
+
+The entrypoint gives the Server a fixed budget to answer on its REST port and
+ends the container when the budget runs out. It is 120 seconds by default. Set
+`HG_SERVER_STARTUP_TIMEOUT_S` to a whole number of seconds between 1 and 86400
+to change it:
+
+```bash
+docker run -itd --name=graph -p 8080:8080 -e HG_SERVER_STARTUP_TIMEOUT_S=450
hugegraph/hugegraph:1.7.0
+```
+
+The Compose topologies under `docker/` pass the variable through to every
+Server with an unset-only default, so `HG_SERVER_STARTUP_TIMEOUT_S=450 docker
+compose up -d` raises the budget without editing a Compose file, while leaving
+it unset renders the same 120.
Review Comment:
Fixed in f2c6a1ff4. `docker/README.md` gets a "Server startup timeout"
section beside the other host variables, with the `up -d` example, the unset
and empty semantics, the roughly 360 second health budget this variable does
not move, and a link to section 7 for the accepted range and the health check
details.
--
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]