scripts: pre-script the ana-ml2->fv-ml1 rename sweep (scoped, dry-run default, history-safe)
This commit is contained in:
Executable
+85
@@ -0,0 +1,85 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# fv-ml1-rename-sweep.sh — the cosmetic half of the ana-ml2 -> fv-ml1 cutover.
|
||||||
|
# Run AT cutover, AFTER the box serves at Fountain Valley and the DNS + LiteLLM
|
||||||
|
# steps in docs/runbooks/fv-ml1-cutover.md are done.
|
||||||
|
#
|
||||||
|
# ⚠ SCOPED ON PURPOSE. A blind `sed s/ana-ml2/fv-ml1/g` across the repo would
|
||||||
|
# rewrite HISTORY — dated persistent-memory entries, archival-memory, incident
|
||||||
|
# records, and model .PROVENANCE.txt prose all say "ana-ml2" because that is what
|
||||||
|
# the box WAS when those things happened. Rewriting them makes the record lie.
|
||||||
|
# This touches ONLY current-state files (the server tables, live display refs,
|
||||||
|
# ssh targets, playbooks) on an explicit ALLOWLIST, and prints a manual-review
|
||||||
|
# list for the judgement calls it deliberately will not automate.
|
||||||
|
#
|
||||||
|
# Default is DRY-RUN. Pass --apply to make changes. Not idempotent-hostile: safe
|
||||||
|
# to re-run (already-renamed files simply match nothing).
|
||||||
|
set -uo pipefail
|
||||||
|
APPLY=0; [ "${1:-}" = "--apply" ] && APPLY=1
|
||||||
|
OLD_IP=10.250.50.54; NEW_IP=10.251.50.54
|
||||||
|
say(){ echo " $*"; }
|
||||||
|
run(){ if [ "$APPLY" = 1 ]; then eval "$@"; else echo " DRY: $*"; fi; }
|
||||||
|
|
||||||
|
# --- files that describe CURRENT STATE (safe to repoint) --------------------
|
||||||
|
ALLOW=(
|
||||||
|
CLAUDE.md
|
||||||
|
README.md
|
||||||
|
docs/runbooks/disaster-recovery.md
|
||||||
|
docs/pfi/proxmox-vms.md
|
||||||
|
docs/pfi/docker-stack.md
|
||||||
|
docs/pfi/reranker-selection-ledger.md
|
||||||
|
servers/pfi-pve/README.md
|
||||||
|
stacks/homepage/conf/services.yaml
|
||||||
|
stacks/homepage/conf/docker.yaml
|
||||||
|
stacks/homepage/README.md
|
||||||
|
stacks/beszel/README.md
|
||||||
|
stacks/dockge/.env.example
|
||||||
|
stacks/llama-swap/compose.yaml
|
||||||
|
stacks/gemma4-charrp/compose.yaml
|
||||||
|
stacks/gemma4-charrp/README.md
|
||||||
|
stacks/meromero-charrp/compose.yaml
|
||||||
|
stacks/erp-seat/compose.yaml
|
||||||
|
stacks/sglang/compose.yaml
|
||||||
|
stacks/heretic2-charrp-reasoning/README.md
|
||||||
|
)
|
||||||
|
# --- NEVER touched: history, provenance, the mirror -------------------------
|
||||||
|
# persistent-memory.md, persistent-memory.d/, archival-memory.md,
|
||||||
|
# **/*.PROVENANCE.txt (on the box, not the repo), graphify-out/, stacks-mirror/
|
||||||
|
|
||||||
|
echo "=== 1. rename the server dir ==="
|
||||||
|
if [ -d servers/ana-ml2 ]; then run "git mv servers/ana-ml2 servers/fv-ml1"; else say "servers/ana-ml2 already moved"; fi
|
||||||
|
|
||||||
|
echo "=== 2. rename ana-ml2 playbooks ==="
|
||||||
|
for f in playbooks/ana-ml2-*.yaml; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
run "git mv '$f' '${f/ana-ml2/fv-ml1}'"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "=== 3. repoint current-state files (name + IP) on the allowlist ==="
|
||||||
|
for f in "${ALLOW[@]}" servers/fv-ml1/README.md servers/fv-ml1/ssh-target playbooks/fv-ml1-*.yaml; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
if grep -qE "ana-ml2|$OLD_IP" "$f" 2>/dev/null; then
|
||||||
|
say "edit $f"
|
||||||
|
run "sed -i 's/$OLD_IP/$NEW_IP/g; s/ana-ml2/fv-ml1/g' '$f'"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# BMC + site labels are hand-verified below, not blanket-sed (10.250.250.50 -> 10.251.250.50,
|
||||||
|
# 'Anaheim' -> 'Fountain Valley' only where it means THIS box).
|
||||||
|
echo "=== 4. BMC IP + site label (targeted) ==="
|
||||||
|
run "sed -i 's/10.250.250.50/10.251.250.50/g' servers/fv-ml1/README.md CLAUDE.md docs/runbooks/disaster-recovery.md 2>/dev/null || true"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "=== MANUAL REVIEW (NOT automated — judgement calls) ==="
|
||||||
|
cat <<'REVIEW'
|
||||||
|
- stacks/ana-ml2-proxy/ : the Homepage Docker-API relay is named + built around
|
||||||
|
ana-ml2. Decide: rename the stack to fv-ml1-proxy and repoint :2375, or retire it
|
||||||
|
if Homepage reaches FV over the mesh directly. Not auto-renamed (stack identity).
|
||||||
|
- stacks/litellm/conf/config.yaml : handled by the LiteLLM step in the runbook
|
||||||
|
(api_base repoint), NOT here — its comments carry historical model notes.
|
||||||
|
- servers/fv-ml1/README.md : re-read fully — site is now Fountain Valley, the BMC
|
||||||
|
subnet is 10.251.250.x, the mesh path is the OPNsense subnet-router (not ana-scale).
|
||||||
|
- dns/internal.yaml : handled by the DNS step (piggyback records), NOT here.
|
||||||
|
- 'Anaheim' prose in the allowlisted docs : change to 'Fountain Valley' only where it
|
||||||
|
refers to THIS box, not the colo generally. grep -n Anaheim <file> and eyeball.
|
||||||
|
REVIEW
|
||||||
|
echo
|
||||||
|
[ "$APPLY" = 1 ] && echo "APPLIED. Review the diff: git diff --stat" || echo "DRY-RUN. Re-run with --apply to make changes."
|
||||||
Reference in New Issue
Block a user