SPB Git

Repository Public

deploy-nodes.sh 4.3 KB 79 lines shellscript

1#!/bin/bash2# =============================================================================3#                  SP BOUCHER | SOFTWARE & RESEARCH4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : SP Boucher Development Standard8# File             : deploy-nodes.sh9# Module           : Scripts10# Repository       : https://git.spboucher.ai/sp-development-standard11# Project Website  : https://git.spboucher.ai/sp-development-standard12# Created          : 2026-12-0213# Last Modified    : 2026-12-0214#15# Author           : Simon-Pierre Boucher16# Position         : Professor of Finance17# Institution      : Université du Québec en Outaouais (UQO)18# Organization     : SP Boucher19# Website          : https://spboucher.ai20# Git              : https://git.spboucher.ai21#22# Preferred Contact: contact@spboucher.ai23# Development      : dev@spboucher.ai24# Support          : support@spboucher.ai25# Security/Admin   : admin@spboucher.ai26#27# Copyright (c) 202628# Simon-Pierre Boucher29# All rights reserved where applicable. This file is governed by the30# applicable project license, copyright notices and relevant law.31# Existing third-party rights and notices remain unaffected.32#33# License          : None specified (no license file in this repository)34#35# Do not embed credentials, private keys, access tokens,36# certificates or confidential personal information.37#38# =============================================================================39# END OF SP BOUCHER SOURCE HEADER40# =============================================================================4142# SP Boucher development standard — deploy to MacLustr nodes (macOS and Linux) over SSH, in parallel.43#   ./deploy-nodes.sh NODE…            install/update on the named SSH aliases44#   ./deploy-nodes.sh --detect NODE…   only on nodes where Claude Code is present (claude binary or ~/.claude)45#   ./deploy-nodes.sh --verify NODE…   run sp-dev-doctor --quick only46# The kit is copied to ~/.sp-development-standard on the node and installed there with ./install.sh.47# Nothing secret is copied; the optional machine-local overrides (list of repositories whose attribution is under48# review) are copied when present on this machine.49set -uo pipefail50HERE="$(cd "$(dirname "$0")" && pwd)"51MODE=install; DETECT=0; NODES=()52for a in "$@"; do case "$a" in --detect) DETECT=1;; --verify) MODE=verify;; -*) echo "unknown option $a" >&2; exit 2;; *) NODES+=("$a");; esac; done53[ ${#NODES[@]} -gt 0 ] || { echo "usage: $0 [--detect] [--verify] NODE…" >&2; exit 2; }54S=(ssh -o BatchMode=yes -o ConnectTimeout=12)55OUT="$(mktemp -d)"; trap 'rm -rf "$OUT"' EXIT56LOCAL="$HOME/.claude/standards/local/overrides.json"57one() {58  n="$1"59  RP='export PATH="$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:$PATH";'60  if [ "$MODE" = verify ]; then61    "${S[@]}" "$n" "$RP"' ~/.claude/bin/sp-dev-doctor --quick 2>&1 | tail -1' > "$OUT/$n" 2>&1 || echo "FAILED: $(tail -1 "$OUT/$n")" > "$OUT/$n"; return62  fi63  if [ $DETECT = 1 ]; then64    "${S[@]}" "$n" "$RP"' command -v claude >/dev/null 2>&1 || [ -d ~/.claude ]' 2>/dev/null || { echo "skipped (no Claude Code, or unreachable)" > "$OUT/$n"; return; }65  fi66  if ! COPYFILE_DISABLE=1 tar -C "$HERE" --exclude .git --exclude __pycache__ --exclude .DS_Store -czf - . \67      | "${S[@]}" "$n" 'rm -rf ~/.sp-development-standard.new && mkdir -p ~/.sp-development-standard.new && tar -xzf - -C ~/.sp-development-standard.new 2>/dev/null && rm -rf ~/.sp-development-standard && mv ~/.sp-development-standard.new ~/.sp-development-standard' 2>"$OUT/$n.err"; then68    echo "FAILED: copy ($(tail -1 "$OUT/$n.err"))" > "$OUT/$n"; return69  fi70  if [ -f "$LOCAL" ]; then71    "${S[@]}" "$n" 'mkdir -p ~/.claude/standards/local && cat > ~/.claude/standards/local/overrides.json' < "$LOCAL" 2>/dev/null72  fi73  "${S[@]}" "$n" "$RP"' cd ~/.sp-development-standard && ./install.sh >/tmp/sp-standard-install.log 2>&1 && ~/.claude/bin/sp-dev-doctor --quick 2>&1 | tail -1 || { echo "FAILED: $(tail -2 /tmp/sp-standard-install.log | tr "\n" " ")"; }' > "$OUT/$n" 2>&174}75for n in "${NODES[@]}"; do one "$n" & done; wait76RC=077for n in "${NODES[@]}"; do r="$(tail -1 "$OUT/$n" 2>/dev/null)"; printf '%-10s %s\n' "$n" "${r:-FAILED: no answer}"; case "$r" in *HEALTHY*|skipped*) ;; *) RC=1;; esac; done78exit $RC79
Files main
Menu

Theme