From 20872b238327930b86836042b0e0415678144acf Mon Sep 17 00:00:00 2001 From: EiSiMo Date: Thu, 23 Apr 2026 11:16:19 +0200 Subject: [PATCH] fix(web): read SOURCE_COMMIT directly, don't reference it in compose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous attempt mapped GIT_COMMIT=${SOURCE_COMMIT:-dev} in compose. That backfired: Coolify parses the compose, sees ${SOURCE_COMMIT}, auto-registers it as a user-defined env var with my "dev" default, and then *skips* its own SHA injection — because the registration guard is "only inject if user hasn't defined it." Result: container got SOURCE_COMMIT=dev and footer kept showing build dev. Drop the compose reference entirely so Coolify's auto-injection takes over, and read SOURCE_COMMIT in settings.py (with GIT_COMMIT kept as the local-dev override). One-time cleanup of the orphan SOURCE_COMMIT rows in the Coolify DB was done out-of-band. Co-Authored-By: Claude Opus 4.7 (1M context) --- docker-compose.yml | 7 ++++--- web/settings.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index d7895d7..411063d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,10 @@ services: apply: condition: service_started environment: - # Coolify injects SOURCE_COMMIT at runtime on every deploy; settings.py - # reads GIT_COMMIT and renders it in the footer. - - GIT_COMMIT=${SOURCE_COMMIT:-dev} + # SOURCE_COMMIT is auto-injected by Coolify at runtime; settings.py + # reads it and renders it in the footer. Don't reference it here — + # Coolify treats any ${SOURCE_COMMIT} in the compose as a user env + # var and stops injecting the real SHA. - AUTH_USERNAME=${AUTH_USERNAME} - AUTH_PASSWORD_HASH=${AUTH_PASSWORD_HASH} - SESSION_SECRET=${SESSION_SECRET} diff --git a/web/settings.py b/web/settings.py index dfed3e9..7e8a09d 100644 --- a/web/settings.py +++ b/web/settings.py @@ -62,6 +62,6 @@ ANTHROPIC_MODEL: str = getenv("ANTHROPIC_MODEL", "claude-haiku-4-5-20251001") # --- Build info -------------------------------------------------------------- # Coolify injects SOURCE_COMMIT into the container's runtime env on every -# deploy; docker-compose.yml maps it to GIT_COMMIT. Rendered in the site -# footer so the running commit is visible at a glance. -GIT_COMMIT: str = getenv("GIT_COMMIT", "").strip() or "dev" +# deploy. GIT_COMMIT is the local-dev override. Rendered in the footer so +# the running commit is visible at a glance. +GIT_COMMIT: str = (getenv("GIT_COMMIT") or getenv("SOURCE_COMMIT") or "").strip() or "dev"