Let the conf push seed a node that has no master.conf yet, which is the node it exists to seed

This commit is contained in:
Gmer4Lfe
2026-08-16 13:05:04 -04:00
parent 6d9c856514
commit 0fe3435033
2 changed files with 29 additions and 6 deletions
+12 -1
View File
@@ -535,7 +535,18 @@ if [[ "$PHASE1_ONLY" == true ]]; then
echo " Duration: $(format_duration $(( END - START )))" echo " Duration: $(format_duration $(( END - START )))"
echo "" echo ""
echo " HOST1 is fully set up. HOST2 ($MIRROR) can now install the Varaverk plugin." echo " HOST1 is fully set up. HOST2 ($MIRROR) can now install the Varaverk plugin."
echo " The wizard will detect the pushed conf and take the correct path." # The push needs a Varaverk install to land in — varaverk.cfg and Configurations/ have to
# exist on the far side. Before the plugin is installed there is nowhere to put the file, so
# a skip here is the expected result of running Phase 1 first, not a fault to chase.
if [[ "$CONF_PUSH_OK" == true ]]; then
echo " master.conf is on $MIRROR — the wizard will find it and take the partner path."
else
echo " master.conf was NOT delivered — $MIRROR has no Varaverk install to receive it yet."
echo " That is expected at this stage. Once the plugin is installed there, either:"
echo " • re-run: bash Partnership/partnership_onboard.sh --phase1-only --skip-ssh"
echo " • or push from Scheduler → master.conf → Save Conf"
echo " • or, from HOST2's Setup tab, use 'Pull from HOST1' on the master.conf row"
fi
echo " When HOST2 completes its onboard, it will automatically trigger Phase 2 here." echo " When HOST2 completes its onboard, it will automatically trigger Phase 2 here."
echo "━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━"
exit 0 exit 0
+17 -5
View File
@@ -296,9 +296,22 @@ function vv_push_master_conf(): array {
continue; continue;
} }
// Single SSH call: get remote SCRIPTS_DIR and verify plugin is installed, // Single SSH call: get remote SCRIPTS_DIR and verify the plugin is installed and
// Configurations/ exists, and master.conf is already present. // Configurations/ exists. Any missing piece means the remote isn't ready — skip rather
// Any missing piece means the remote isn't ready — skip rather than push blind. // than push blind.
//
// It deliberately does NOT require master.conf to already be there. Requiring it meant
// this could only ever *update* a conf, never deliver one — and delivering is what Step 10
// of partnership_onboard.sh exists to do. Every conf is gitignored, so a freshly installed
// node has varaverk.cfg and Configurations/ (README.md is tracked, so the clone creates the
// dir) but no master.conf, and the push skipped exactly the node it was meant to seed.
//
// The two surviving checks still refuse a bare or half-installed host, so nothing is
// pushed into a directory that is not a Varaverk install.
//
// NOTE: this sends the owner's master.conf as-is, credentials included — TAILSCALE_API_KEY
// and WEBHOOK_SECRET among them. That is the accepted trade for one shared config across
// the mesh; a node you would not hand those to should not be a listed host.
// Remote command built as one PHP string and escapeshellarg()'d whole — shell_exec() // Remote command built as one PHP string and escapeshellarg()'d whole — shell_exec()
// adds its own `sh -c` layer locally, so a bare double-quoted string here would let // adds its own `sh -c` layer locally, so a bare double-quoted string here would let
// the $(...)/${...} substitutions expand on HOST1 before ssh ever sees them, instead // the $(...)/${...} substitutions expand on HOST1 before ssh ever sees them, instead
@@ -308,13 +321,12 @@ function vv_push_master_conf(): array {
$remoteCmd = 'cfg=$(grep SCRIPTS_DIR /boot/config/plugins/varaverk/varaverk.cfg 2>/dev/null)' $remoteCmd = 'cfg=$(grep SCRIPTS_DIR /boot/config/plugins/varaverk/varaverk.cfg 2>/dev/null)'
. ' && sd=$(echo "$cfg" | grep -oP \'(?<=SCRIPTS_DIR=")[^"]+\')' . ' && sd=$(echo "$cfg" | grep -oP \'(?<=SCRIPTS_DIR=")[^"]+\')'
. ' && test -d "${sd}/Configurations"' . ' && test -d "${sd}/Configurations"'
. ' && test -f "${sd}/Configurations/master.conf"'
. ' && echo "$sd"'; . ' && echo "$sd"';
$probe = trim(shell_exec($sshBase . ' ' . escapeshellarg($remoteCmd)) ?: ''); $probe = trim(shell_exec($sshBase . ' ' . escapeshellarg($remoteCmd)) ?: '');
if ($probe === '') { if ($probe === '') {
$results[] = ['host' => $hostKey, 'ok' => false, 'ready' => false, $results[] = ['host' => $hostKey, 'ok' => false, 'ready' => false,
'error' => 'plugin not installed, dir missing, or master.conf absent — skipped']; 'error' => 'plugin not installed or Configurations/ missing — skipped'];
continue; continue;
} }