From 78d2ab262327084a839bf06ad240650acb575eac Mon Sep 17 00:00:00 2001 From: Tobias Weiske Date: Sun, 23 Aug 2026 15:19:21 +0200 Subject: [PATCH] Status-Datei und Deploy-Hook-Pfad explizit in install.env statt implizit abgeleitet Bisher wurde der Hook-Pfad aus dem letzten Segment von WEBSITE_REPO abgeleitet, die Status-Datei war fix auf ~/deploy/status.json gesetzt. Beides sieht pro Instanz eindeutig aus, ist es aber nicht: Live auf einer Demo-Installation gefunden, bei der zwei Ableger-Instanzen auf demselben Account beide denselben abgeleiteten Hook-Pfad (website.git) erhielten - der Trigger-Button einer Instanz loeste den Deploy der anderen aus, die Status-Seite zeigte dauerhaft 'kein Status vorhanden' statt echter Daten. Neue optionale install.env-Werte DEPLOY_STATUS_FILE/DEPLOY_HOOK_PATH, Default identisch zum bisherigen Standardfall (eine Instanz pro Server) - nur bei mehreren Instanzen auf demselben Account muss man sie anpassen. --- install.env | 14 ++++++++++++++ scripts/admin-status-server.rb | 18 +++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/install.env b/install.env index 645410a..758e744 100644 --- a/install.env +++ b/install.env @@ -46,3 +46,17 @@ DEPLOY_DOCROOT="/pfad/zu/deinem/docroot" # Port the admin status server (scripts/admin-status-server.rb) listens # on. STATUS_SERVER_PORT="4182" + +# Path to the status file the deploy hook writes after every run, and to +# the deploy hook itself (invoked by the manual trigger button on +# /admin/status/). Must match the STATUS_FILE/HOOK paths used in your own +# post-receive hook script (see the "Installation" chapter, Schritt 7) - +# both default to a single-instance-per-server assumption below, which +# breaks if you ever run a second Ableger instance (or any other deploy +# pipeline whose bare-repo name happens to collide) on the same account: +# found live when two Ableger instances on one Uberspace account both +# derived the same "website.git" hook path from WEBSITE_REPO, so the +# newer instance's trigger button silently ran the OTHER instance's +# deploy. Only override these two if that applies to you. +DEPLOY_STATUS_FILE="~/deploy/status.json" +DEPLOY_HOOK_PATH="~/repos/website.git/hooks/post-receive" diff --git a/scripts/admin-status-server.rb b/scripts/admin-status-server.rb index f2d2b0d..99647dd 100644 --- a/scripts/admin-status-server.rb +++ b/scripts/admin-status-server.rb @@ -13,9 +13,8 @@ # This script itself does not check authorization, that is handled entirely # by the oauth2-proxy gate in front of it. # -# STATUS_FILE is written by the deploy hook itself (~/repos/ableger.git/ -# hooks/post-receive on the server, not part of this repo - see -# the installation guide on the project website), not by this script. +# STATUS_FILE is written by the deploy hook itself (path from install.env, +# see there - not part of this repo), not by this script. require 'webrick' require 'json' @@ -34,10 +33,15 @@ end INSTALL_ENV = load_install_env(File.expand_path('../install.env', __dir__)) -STATUS_FILE = File.expand_path('~/deploy/status.json') -# Bare repo name (see the installation guide on the project website, Abschnitt 4) is derived from -# the website repo name, not maintained separately. -HOOK = File.expand_path("~/repos/#{INSTALL_ENV.fetch('WEBSITE_REPO').split('/').last}.git/hooks/post-receive") +# Explicit paths from install.env, not derived from WEBSITE_REPO - a +# derived name (e.g. the repo's last path segment) looks unique per +# instance but isn't guaranteed to be: found live when a second Ableger +# instance on the same account derived the same "website.git" hook path as +# an unrelated first one, so its trigger button silently ran the wrong +# deploy. Only relevant to change on a fork running more than one instance +# (or another deploy pipeline with a colliding name) on the same server. +STATUS_FILE = File.expand_path(INSTALL_ENV.fetch('DEPLOY_STATUS_FILE')) +HOOK = File.expand_path(INSTALL_ENV.fetch('DEPLOY_HOOK_PATH')) DOCROOT = INSTALL_ENV.fetch('DEPLOY_DOCROOT') PORT = INSTALL_ENV.fetch('STATUS_SERVER_PORT').to_i