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:
+14
@@ -46,3 +46,17 @@ DEPLOY_DOCROOT="/pfad/zu/deinem/docroot"
|
|||||||
# Port the admin status server (scripts/admin-status-server.rb) listens
|
# Port the admin status server (scripts/admin-status-server.rb) listens
|
||||||
# on.
|
# on.
|
||||||
STATUS_SERVER_PORT="4182"
|
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"
|
||||||
|
|||||||
@@ -13,9 +13,8 @@
|
|||||||
# This script itself does not check authorization, that is handled entirely
|
# This script itself does not check authorization, that is handled entirely
|
||||||
# by the oauth2-proxy gate in front of it.
|
# by the oauth2-proxy gate in front of it.
|
||||||
#
|
#
|
||||||
# STATUS_FILE is written by the deploy hook itself (~/repos/ableger.git/
|
# STATUS_FILE is written by the deploy hook itself (path from install.env,
|
||||||
# hooks/post-receive on the server, not part of this repo - see
|
# see there - not part of this repo), not by this script.
|
||||||
# the installation guide on the project website), not by this script.
|
|
||||||
require 'webrick'
|
require 'webrick'
|
||||||
require 'json'
|
require 'json'
|
||||||
|
|
||||||
@@ -34,10 +33,15 @@ end
|
|||||||
|
|
||||||
INSTALL_ENV = load_install_env(File.expand_path('../install.env', __dir__))
|
INSTALL_ENV = load_install_env(File.expand_path('../install.env', __dir__))
|
||||||
|
|
||||||
STATUS_FILE = File.expand_path('~/deploy/status.json')
|
# Explicit paths from install.env, not derived from WEBSITE_REPO - a
|
||||||
# Bare repo name (see the installation guide on the project website, Abschnitt 4) is derived from
|
# derived name (e.g. the repo's last path segment) looks unique per
|
||||||
# the website repo name, not maintained separately.
|
# instance but isn't guaranteed to be: found live when a second Ableger
|
||||||
HOOK = File.expand_path("~/repos/#{INSTALL_ENV.fetch('WEBSITE_REPO').split('/').last}.git/hooks/post-receive")
|
# 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')
|
DOCROOT = INSTALL_ENV.fetch('DEPLOY_DOCROOT')
|
||||||
PORT = INSTALL_ENV.fetch('STATUS_SERVER_PORT').to_i
|
PORT = INSTALL_ENV.fetch('STATUS_SERVER_PORT').to_i
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user