diff --git a/.env.example b/.env.example index f74b416..0c6c8ba 100644 --- a/.env.example +++ b/.env.example @@ -23,11 +23,12 @@ ADMIN_IDS= # Only the twentyq module needs this. Leave blank to disable that command. GEMINI_API_KEY= -# SOURCE_COMMIT (commit SHA) is auto-injected into the container at runtime by -# Coolify and read at startup for the deploynotify owner DM — do NOT set it here -# and do NOT declare it in docker-compose (that would clobber Coolify's value -# with an empty string). Local `docker compose up` has none, so deploynotify -# just stays silent. +# SOURCE_COMMIT (commit SHA) is read at startup for the deploynotify owner DM. +# Do NOT set it here. On Coolify (Docker Compose) it is a predefined variable +# that reaches the container only because docker-compose.yml references it +# (`SOURCE_COMMIT: ${SOURCE_COMMIT:-}`) — Coolify supplies the value via +# --env-file. Local `docker compose up` has none, so deploynotify reports +# "unknown". # ====================== Leave UNSET on self-host ================== # These are AWS-only. cmd/server reads secrets directly from the plain env diff --git a/docker-compose.yml b/docker-compose.yml index 54ece36..86b5072 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,11 +16,13 @@ services: ADMIN_IDS: ${ADMIN_IDS} # CSV of admin Telegram user ids # --- Optional --- GEMINI_API_KEY: ${GEMINI_API_KEY} # only the twentyq module needs it - # SOURCE_COMMIT (commit SHA, read at startup for the deploynotify owner DM) - # is auto-injected into the container by Coolify — do NOT declare it here. - # A `SOURCE_COMMIT: ${SOURCE_COMMIT:-}` entry resolves to "" at compose-parse - # time and would clobber Coolify's runtime value. Local `docker compose up` - # has no SOURCE_COMMIT, so deploynotify just stays silent there. + # SOURCE_COMMIT (commit SHA, read at startup for the deploynotify owner DM). + # For Docker Compose, Coolify passes predefined vars via --env-file for + # interpolation ONLY — the var reaches the container only if referenced + # here (per Coolify docs). The :- default keeps local `docker compose up` + # (where SOURCE_COMMIT is unset) quiet; on Coolify the real value wins, so + # deploynotify reports "unknown" only outside Coolify. + SOURCE_COMMIT: ${SOURCE_COMMIT:-} # 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. diff --git a/docs/deploy-coolify-selfhosted.md b/docs/deploy-coolify-selfhosted.md index f0df31c..cfe4ef4 100644 --- a/docs/deploy-coolify-selfhosted.md +++ b/docs/deploy-coolify-selfhosted.md @@ -88,12 +88,14 @@ SSM/AWS lookup that fails with no AWS creds and bricks startup), `KV_PROVIDER`, bot token; a second poller gets HTTP 409, and a second in-process scheduler double-fires crons. Prefer **stop-first redeploys** so two containers never overlap near a cron time. -5. **deploynotify commit SHA:** Coolify auto-injects `SOURCE_COMMIT` (a - predefined runtime env var) into the container, and the bot reads it at - startup to DM the owner the "new version" notice — no manual wiring, and do - **not** declare `SOURCE_COMMIT` in compose/env (a `${SOURCE_COMMIT:-}` entry - resolves to `""` at parse time and clobbers Coolify's value). Without it, - `deploynotify` stays silent (no crash) — but you lose that notification. +5. **deploynotify commit SHA:** `SOURCE_COMMIT` is a Coolify predefined + variable. For Docker Compose, Coolify passes predefined vars via `--env-file` + for interpolation only, so the value reaches the container **only because + `docker-compose.yml` references it** (`SOURCE_COMMIT: ${SOURCE_COMMIT:-}`). + The bot reads it at startup and DMs the owner on every boot; outside Coolify + (local `docker compose up`) it is unset and the DM shows `unknown`. The + "Include Source Commit in Build" Coolify setting affects build args only and + is **not** needed for this runtime path. 6. **Health check:** use Coolify's HTTP monitor against `GET /` (returns `text/plain` `miti99bot ok`). Do **not** use a compose `healthcheck` — the distroless image has no shell/curl and `cmd/server` has no `-healthcheck`