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