Files
tiennm99bot/compose.yml
T
tiennm99 83321fa330 refactor(renderer)!: prefix every renderer env var with RENDERER_
The renderer's settings now read RENDERER_HOST, RENDERER_PORT,
RENDERER_MAX_CONCURRENT_RENDERS, RENDERER_RENDER_TIMEOUT_MS,
RENDERER_MAX_OPTIONS, and RENDERER_MAX_OPTION_CHARS, so they read as
renderer settings and cannot clash with the bot's variables, which
Coolify injects into every service. NODE_ENV keeps its standard name.

BREAKING CHANGE: the unprefixed HOST, PORT, MAX_CONCURRENT_RENDERS,
RENDER_TIMEOUT_MS, MAX_OPTIONS, and MAX_OPTION_CHARS are no longer read
by the renderer.
2026-10-03 12:05:56 +07:00

75 lines
3.7 KiB
YAML

services:
bot:
build:
context: .
# Or pin a prebuilt image instead of building:
# image: ghcr.io/tiennm99/miti99bot:latest
restart: unless-stopped
environment:
# --- Required ---
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
MONGO_URL: ${MONGO_URL} # Atlas SRV string incl. credentials — SECRET
MONGO_DATABASE: ${MONGO_DATABASE}
# --- Operational ---
MODULES: ${MODULES} # CSV; empty = all modules
OWNER_ID: ${OWNER_ID} # Telegram user id for owner-only commands
ADMIN_IDS: ${ADMIN_IDS} # CSV of admin Telegram user ids
# The bundled renderer service below draws /wheelofnames, /gacha and
# /genshin. Its base URL is fixed to the in-network address so a stale
# platform-level value cannot point the bot elsewhere; the bot appends
# each /api/<name> route itself.
RENDERER_URL: http://renderer:3000
# SOURCE_COMMIT is intentionally not declared here. Coolify provides it
# at runtime via its generated env file; declaring it here with Compose
# interpolation can override the runtime value with an empty string.
# Storage auto-selects mongodb because MONGO_URL is set — no KV_PROVIDER.
# The in-process cron scheduler runs by default — no CRON_MODE.
# PORT defaults to 8080 (internal health server) — omit unless overriding.
# Long polling = no TELEGRAM_WEBHOOK_SECRET, no /webhook, no public domain.
# Cron is in-process only — there is no /cron HTTP route and no secret.
# No stock/coin/gold URL env overrides — modules use their coded default
# providers (stock: SSI/VCI/KBS; coin: Binance->Coinbase->CoinGecko;
# gold: VNAppMob). If GOLD_VNAPP_API_KEY is unset, the bot auto-fetches
# and caches a key to Mongo.
# Long polling is outbound-only: nothing inbound to route, so no published
# ports and no public domain. `expose` only documents the health server's
# port; it publishes nothing on the host.
expose:
- "8080"
# Coolify's UI health check does not apply to Docker Compose apps; it reads
# this block instead. GET / returns text/plain "miti99bot ok". It proves the
# process is serving, not that Mongo is reachable — see
# docs/deploy-coolify-selfhosted.md. busybox wget ships in the Alpine image.
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8080/ || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
# Animation renderer (Node + Remotion + headless Chrome) from renderer/.
# Internal only: the bot reaches it over the compose network, so it has no
# published port, no public domain, and no auth token. Never publish a port
# or attach a domain to it — its API is unauthenticated.
renderer:
build:
context: ./renderer
restart: unless-stopped
environment:
NODE_ENV: production
# Every renderer setting carries the RENDERER_ prefix so it cannot clash
# with the bot's variables, which Coolify also injects into this service.
RENDERER_HOST: 0.0.0.0
RENDERER_PORT: "3000" # keep in sync with the bot's RENDERER_URL and the healthcheck
RENDERER_MAX_CONCURRENT_RENDERS: ${RENDERER_MAX_CONCURRENT_RENDERS:-1}
RENDERER_RENDER_TIMEOUT_MS: ${RENDERER_RENDER_TIMEOUT_MS:-15000}
RENDERER_MAX_OPTIONS: ${RENDERER_MAX_OPTIONS:-32}
RENDERER_MAX_OPTION_CHARS: ${RENDERER_MAX_OPTION_CHARS:-40}
expose:
- "3000"
healthcheck:
test: ["CMD-SHELL", "node -e \"fetch('http://127.0.0.1:3000/api/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 30s
timeout: 5s
retries: 3