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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user