ops(compose): align the deploy template defaults and gate the healthcheck

Two template landmines for anyone running docker compose from the tracked files. (1) LOCAL_USER_ID defaulted to 1000 in compose and .env.example while the entrypoint and both READMEs say 9001 — the ./data owner on the host silently depended on which doc you read; all four now say 9001. (2) The healthcheck probed WEBHOOK_PORT unconditionally, so the template's own WEBHOOK=false (polling, no listener) shipped a permanently unhealthy container — the probe is now conditional on the interpolated WEBHOOK value (test '<v>' != true || exec 3<>/dev/tcp/…): polling deployments answer healthy without a port, webhook deployments still surface a dead listener to the orchestrator. Both expressions verified locally; compose YAML parses.
This commit is contained in:
2026-09-24 03:47:34 +08:00
parent 3dbcb45899
commit 7bdf760c7b
2 changed files with 10 additions and 6 deletions
+6 -5
View File
@@ -64,7 +64,7 @@ services:
WEBHOOK_URL: '${WEBHOOK_URL:-}'
WEBHOOK_SECRET_TOKEN: '${WEBHOOK_SECRET_TOKEN:-}'
# Defaults, listed so they are discoverable; override in .env when needed.
LOCAL_USER_ID: '${LOCAL_USER_ID:-1000}'
LOCAL_USER_ID: '${LOCAL_USER_ID:-9001}'
RUST_LOG: '${RUST_LOG:-info}'
EDIT_MESSAGE_TTL_SECONDS: '${EDIT_MESSAGE_TTL_SECONDS:-86400}'
LINK_CACHE_TTL_SECONDS: '${LINK_CACHE_TTL_SECONDS:-604800}'
@@ -88,11 +88,12 @@ services:
- nginx-proxy
container_name: tgxmb
logging: *default-logging
# Webhook mode only (in polling mode there is no listener, so drop this
# block or set WEBHOOK=true): the bot listens on WEBHOOK_PORT; nginx-proxy
# shows 502s while this is down, so surface it to the orchestrator.
# Probes the listener only when WEBHOOK=true (compose interpolates the
# value from .env); a polling deployment has no listener and must not be
# reported unhealthy. nginx-proxy shows 502s while webhook mode is down,
# so surface that to the orchestrator.
healthcheck:
test: ["CMD-SHELL", "bash -c 'exec 3<>/dev/tcp/127.0.0.1/${WEBHOOK_PORT:-8443}'"]
test: ["CMD-SHELL", "test '${WEBHOOK:-true}' != true || exec 3<>/dev/tcp/127.0.0.1/${WEBHOOK_PORT:-8443}"]
interval: 30s
timeout: 5s
retries: 3