mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-24 23:42:18 +00:00
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:
+4
-1
@@ -49,6 +49,7 @@ DATA_DIR=data
|
||||
# --- webhook deployment (docker-compose.yml) ------------------------------
|
||||
# false = long polling (no public URL needed). true = webhook behind the
|
||||
# bundled nginx-proxy — and then WEBHOOK_LISTEN/PORT/URL are required.
|
||||
# The compose healthcheck probes the listener only when this is true.
|
||||
WEBHOOK=false
|
||||
# WEBHOOK_LISTEN=0.0.0.0
|
||||
# WEBHOOK_PORT=8443
|
||||
@@ -70,7 +71,9 @@ VIRTUAL_PORT=8443
|
||||
# Certificate notification address for acme-companion.
|
||||
DEFAULT_EMAIL=
|
||||
# UID the container runs as; it must be able to write ./data on the host.
|
||||
LOCAL_USER_ID=1000
|
||||
# The entrypoint's default (and the README's) is 9001 — keep them equal so
|
||||
# the file owner on the host matches what you expect.
|
||||
LOCAL_USER_ID=9001
|
||||
# Uncomment (here and the matching line in docker-compose.yml) to have
|
||||
# acme-companion issue the certificate for VIRTUAL_HOST.
|
||||
# ACME_HOST=
|
||||
|
||||
+6
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user