From 1c64b44a46df7073071373fbdde9b194b94fe1e0 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Sat, 3 Oct 2026 12:46:11 +0700 Subject: [PATCH] chore(deploy): comment out optional compose variables Coolify passes every dashboard variable to each service through its generated .env, so optional values need no compose reference. It also creates a dashboard entry for every referenced variable and keeps an existing empty entry over a ${VAR:-default}, which overrides the compose default. Optional variables are therefore commented-out ${VAR:-default} lines, and the code supplies their defaults. --- compose.yml | 43 +++++++++++++++++-------------- docs/deploy-coolify-selfhosted.md | 23 ++++++++++++++--- renderer/docs/deployment.md | 6 +++-- 3 files changed, 46 insertions(+), 26 deletions(-) diff --git a/compose.yml b/compose.yml index b3d02b8..ab63d39 100644 --- a/compose.yml +++ b/compose.yml @@ -11,18 +11,20 @@ services: MONGO_URL: ${MONGO_URL} # Atlas SRV string incl. credentials — SECRET MONGO_DATABASE: ${MONGO_DATABASE} # e.g. miti99bot - # --- Access control (optional; empty uses the default) --- - MODULES: ${MODULES} # CSV of modules; default: all modules - OWNER_ID: ${OWNER_ID} # Telegram user id for owner-only commands; default: none - ADMIN_IDS: ${ADMIN_IDS} # CSV of admin Telegram user ids; default: none - - # --- Module settings (optional; empty uses the default) --- - LOL_PANDASCORE_TOKEN: ${LOL_PANDASCORE_TOKEN} # PandaScore token — SECRET; default: none (/lol* fetches fail) - GOLD_VNAPP_API_KEY: ${GOLD_VNAPP_API_KEY} # VNAppMob key — SECRET; default: fetched and cached in Mongo - STICKER_PACK_NAME: ${STICKER_PACK_NAME} # /addsticker set; default: miti99_by_miti99bot - - # --- Runtime (optional; empty uses the default) --- - LOG_LEVEL: ${LOG_LEVEL} # debug|info|warn|error; default: info + # --- Optional (commented out; the code falls back to each default) --- + # Coolify injects every dashboard variable into each service through its + # generated .env (env_file), so setting one in the Coolify dashboard is + # enough — no need to uncomment. Coolify also creates a dashboard entry + # for every variable referenced here, and an existing empty entry beats + # the compose default, so these stay commented to keep that from + # happening. Outside Coolify, uncomment a line to pass the variable in. + # MODULES: ${MODULES:-} # CSV of modules; empty = all modules + # OWNER_ID: ${OWNER_ID:-} # Telegram user id for owner-only commands; empty = none + # ADMIN_IDS: ${ADMIN_IDS:-} # CSV of admin Telegram user ids; empty = none + # LOL_PANDASCORE_TOKEN: ${LOL_PANDASCORE_TOKEN:-} # PandaScore token — SECRET; empty = /lol* fetches fail + # GOLD_VNAPP_API_KEY: ${GOLD_VNAPP_API_KEY:-} # VNAppMob key — SECRET; empty = fetched and cached in Mongo + # STICKER_PACK_NAME: ${STICKER_PACK_NAME:-miti99_by_miti99bot} # /addsticker set + # LOG_LEVEL: ${LOG_LEVEL:-info} # debug|info|warn|error # --- Fixed by this stack (not Coolify settings) --- # The bundled renderer service below draws /wheelofnames, /gacha and @@ -32,9 +34,8 @@ services: RENDERER_URL: http://renderer:3000 # --- Deliberately not declared --- - # SOURCE_COMMIT: 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. + # SOURCE_COMMIT: Coolify provides it at runtime via its generated .env; + # declaring it here could override that with an empty value. # PORT: the health server defaults to 8080, which the healthcheck uses. # KV_PROVIDER: storage auto-selects mongodb because MONGO_URL is set. # Long polling = no TELEGRAM_WEBHOOK_SECRET, no /webhook, no public domain. @@ -70,11 +71,13 @@ services: # Every renderer setting carries the RENDERER_ prefix so it reads as a # renderer setting and cannot clash with the bot's variables. - # --- Tuning (optional; empty uses the default) --- - RENDERER_MAX_CONCURRENT_RENDERS: ${RENDERER_MAX_CONCURRENT_RENDERS} # default: 1 - RENDERER_RENDER_TIMEOUT_MS: ${RENDERER_RENDER_TIMEOUT_MS} # default: 15000 (floor 7000) - RENDERER_MAX_OPTIONS: ${RENDERER_MAX_OPTIONS} # default: 32 wheel options - RENDERER_MAX_OPTION_CHARS: ${RENDERER_MAX_OPTION_CHARS} # default: 40 chars per option/label + # --- Optional tuning (commented out; the renderer falls back to each default) --- + # Set any of these in the Coolify dashboard; it reaches this service + # through Coolify's injected .env. Outside Coolify, uncomment a line. + # RENDERER_MAX_CONCURRENT_RENDERS: ${RENDERER_MAX_CONCURRENT_RENDERS:-1} + # RENDERER_RENDER_TIMEOUT_MS: ${RENDERER_RENDER_TIMEOUT_MS:-15000} # floor 7000 + # RENDERER_MAX_OPTIONS: ${RENDERER_MAX_OPTIONS:-32} # wheel options + # RENDERER_MAX_OPTION_CHARS: ${RENDERER_MAX_OPTION_CHARS:-40} # chars per option/label # --- Fixed by this stack (not Coolify settings) --- NODE_ENV: production diff --git a/docs/deploy-coolify-selfhosted.md b/docs/deploy-coolify-selfhosted.md index d4d488d..bc5aae9 100644 --- a/docs/deploy-coolify-selfhosted.md +++ b/docs/deploy-coolify-selfhosted.md @@ -43,6 +43,22 @@ Copy [`.env.example`](../.env.example) → `.env` (gitignored) and fill in. | `PORT` | leave unset | health server port; default `8080` | | `SOURCE_COMMIT` | never set | provided by Coolify at runtime for the deploy DM (see step 5 below) | +`compose.yml` references only the required settings; every optional one is a +commented-out `${VAR:-default}` line, and the code falls back to that default. +Two Coolify behaviours, confirmed in its compose parser, shape this: + +- Coolify writes every dashboard variable into a generated `.env` and adds + `env_file: .env` to each service, so a variable set in the dashboard reaches + the containers whether or not `compose.yml` mentions it. Set optional values + in the dashboard; there is nothing to uncomment. +- Coolify creates a dashboard entry for every variable `compose.yml` + references, and stores a `${VAR:-default}` default only when it first + creates that entry. An existing entry — even an empty one — is written into + the deployed compose as is, so the compose default never applies. Keeping + optional variables unreferenced avoids such empty entries. + +Outside Coolify, uncomment a line in `compose.yml` to pass that variable in. + Stock, coin, and gold provider URL overrides are not supported in runtime env; modules use coded defaults. There is no `TELEGRAM_WEBHOOK_SECRET`: long polling has no webhook. @@ -62,10 +78,9 @@ to it. Renderer tuning (`RENDERER_MAX_CONCURRENT_RENDERS`, `RENDERER_RENDER_TIMEOUT_MS`, `RENDERER_MAX_OPTIONS`, -`RENDERER_MAX_OPTION_CHARS`) is optional. `compose.yml` references each one -without a default, so Coolify lists it as a setting you can fill in or leave -empty; an empty value uses the renderer's default, listed in -[`renderer/docs/deployment.md`](../renderer/docs/deployment.md). Give the host +`RENDERER_MAX_OPTION_CHARS`) is optional; the renderer falls back to the +defaults listed in [`renderer/docs/deployment.md`](../renderer/docs/deployment.md). +Set them in the Coolify dashboard to override. Give the host 1-2 GB of headroom for the renderer's Chrome. Outside compose, set `RENDERER_URL` to the base URL of any service that diff --git a/renderer/docs/deployment.md b/renderer/docs/deployment.md index 9e60694..804b4ba 100644 --- a/renderer/docs/deployment.md +++ b/renderer/docs/deployment.md @@ -40,8 +40,10 @@ RENDERER_MAX_OPTION_CHARS=40 ``` An unset or empty variable uses the default above. The root `compose.yml` -fixes `RENDERER_HOST` and `RENDERER_PORT` and passes the tuning values through -without defaults, so leaving them empty in Coolify uses these defaults. +fixes `RENDERER_HOST` and `RENDERER_PORT` and keeps the tuning values as +commented `${VAR:-default}` lines, so the defaults apply. On Coolify, set a +value in the dashboard to override it; Coolify passes dashboard variables to +every service through its generated `.env`. Start with 1-2 vCPU and 1-2 GB RAM. Increase only after render benchmarks show the service is CPU-bound or concurrency-limited.