From 9e68802090211e1bd0d796ee12626481aa9744f1 Mon Sep 17 00:00:00 2001 From: Hermes Agent service account Date: Fri, 29 May 2026 21:52:33 -0500 Subject: [PATCH] fix(semaphore): make host-agnostic by omitting SEMAPHORE_WEB_ROOT The SPA was rendering regardless of which hostname served the page, causing the imagineering alias to load the same UI but rewrite all in-page navigation back to the semaphore hostname. Confusing for users hitting either Traefik alias. Leave SEMAPHORE_WEB_ROOT empty so Semaphore emits relative URLs and is fully host-agnostic. Both DNS names (semaphore + imagineering) now serve cleanly without preference between them. The template only emits SEMAPHORE_WEB_ROOT when the variable is set, so the env-var is absent from the container when not needed. --- ansible/roles/semaphore/defaults/main.yml | 8 ++++++-- ansible/roles/semaphore/templates/semaphore.container.j2 | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ansible/roles/semaphore/defaults/main.yml b/ansible/roles/semaphore/defaults/main.yml index 0265511..ce52dcc 100644 --- a/ansible/roles/semaphore/defaults/main.yml +++ b/ansible/roles/semaphore/defaults/main.yml @@ -38,8 +38,12 @@ semaphore_postgres_volume: semaphore_postgres_data semaphore_listen_address: "0.0.0.0" semaphore_listen_port: 3000 -# Public URL (used by Semaphore for OIDC redirects, webhook URLs, etc.) -semaphore_web_url: "https://semaphore.local.mk-labs.cloud" +# Public URL used for Semaphore-generated absolute URLs (webhooks, OIDC +# callbacks, etc). Leave EMPTY to make Semaphore host-agnostic — the SPA +# then uses relative URLs and serves cleanly under any hostname Traefik +# points at it. Set to a fully-qualified URL only if a specific feature +# requires an absolute base. +semaphore_web_url: "" # --------------------------------------------------------------------------- # PostgreSQL configuration diff --git a/ansible/roles/semaphore/templates/semaphore.container.j2 b/ansible/roles/semaphore/templates/semaphore.container.j2 index 3a8f241..25da30f 100644 --- a/ansible/roles/semaphore/templates/semaphore.container.j2 +++ b/ansible/roles/semaphore/templates/semaphore.container.j2 @@ -39,7 +39,10 @@ Environment=SEMAPHORE_PLAYBOOK_PATH=/var/lib/semaphore/playbooks Environment=SEMAPHORE_ACCESS_KEY_ENCRYPTION={{ semaphore_access_key_encryption }} # Public-facing URL used for OIDC redirects, webhooks, etc. +# Empty string keeps Semaphore host-agnostic (relative URLs). +{% if semaphore_web_url | length > 0 %} Environment=SEMAPHORE_WEB_ROOT={{ semaphore_web_url }} +{% endif %} # Timezone matches host baseline Environment=TZ=America/Chicago