audit echo vs log across all scripts — outcomes always visible, verbose for per-item loops
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
---
|
||||
name: user_profile
|
||||
description: User profile — Unraid home server operator building Varaverk
|
||||
metadata:
|
||||
node_type: memory
|
||||
type: user
|
||||
originSessionId: a1ac522e-9103-4757-b6d0-a7cd2f5681fb
|
||||
---
|
||||
|
||||
Runs Unraid on two home servers (HOST1: Threadripper 1950X, HOST2: Intel i5 10th gen).
|
||||
Building Varaverk — a self-healing two-server media ecosystem.
|
||||
Email: gmer4lfe@gmail.com
|
||||
Domain: Gmer4Lfe.com / Gmer4Lfe.us
|
||||
|
||||
Practical, hands-on operator. Thinks in design/architecture terms but works at the script/config level.
|
||||
Deals with real-world issues: power outages, reboots, reinstalls.
|
||||
|
||||
**Note:** Claude Code does not persist memory across Unraid reboots unless memory files are on /boot (USB). After any reinstall, point Claude at /boot/config/plugins/varaverk to restore context.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
name: project_varaverk
|
||||
description: Varaverk — self-healing mutually-redundant two-server Unraid home media ecosystem
|
||||
metadata:
|
||||
node_type: memory
|
||||
type: project
|
||||
originSessionId: a1ac522e-9103-4757-b6d0-a7cd2f5681fb
|
||||
---
|
||||
|
||||
**Varaverk** is a complete self-healing, self-maintaining, mutually-redundant two-server home server ecosystem. One codebase runs on both servers. No primary/standby — both servers run independently and cover each other when one goes down.
|
||||
|
||||
## The Two Servers
|
||||
|
||||
**HOST1 — unRAID-Gmer4Lfe**
|
||||
- Hardware: Threadripper 1950X, 128GB RAM, ZFS cache pools
|
||||
- Location: Primary site
|
||||
- Domain: Gmer4Lfe.com
|
||||
- Runs: Arrs (Movies, TV, Music), Auth stack (source of truth), Emby (primary)
|
||||
|
||||
**HOST2 — unRAID-Jayred365**
|
||||
- Hardware: Intel i5 10th gen, 64GB RAM
|
||||
- Location: Remote — different building, different power utility
|
||||
- Domain: Gmer4Lfe.us
|
||||
|
||||
## Architecture
|
||||
- Platform adapter layer (Plugin/unraid/adapter.sh) isolates OS-specific calls — scripts never branch on OS
|
||||
- Self-healing, not enterprise HA — goal is minimal media stack disruption
|
||||
- Tailscale for mesh networking between hosts
|
||||
|
||||
## Active To-Dos (from Notes_To-Do.md)
|
||||
- Fix fallback strike list timing: ~30s first, ~90s for 3-strike trigger — needs testing
|
||||
- Verify silent toggle switches back on good notifications
|
||||
- Rename folder Unraid_Scripts → Varaverk everywhere, update git script, all traces/scripts
|
||||
|
||||
## Future Design Ideas
|
||||
- Shared auth stack for partner hosts to start shared services
|
||||
- When owner offboards with 2+ servers: auto-promote strongest server (by compute + bandwidth)
|
||||
- Overall setup script that pulls vars automatically (docker names, etc.)
|
||||
- App layer as king: no more direct git — app opens/edits settings, partnership deploys to servers, pushes correct host.conf
|
||||
- Web UI: on initial launch with no state file, open master.conf; lock orchs until setup complete
|
||||
- First-launch guide: owner sets up master.conf → host1.conf → Tailscale shares → onboard → host2/3 install and see state file, default to mirror mode
|
||||
|
||||
**Why:** User is building this as a personal project on Unraid. Design philosophy favors simplicity and independence over enterprise tooling.
|
||||
**How to apply:** Understand the two-server mesh model when suggesting architecture. The app layer / web UI direction is the current strategic focus — moving away from raw git/scripts toward a proper application.
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
name: workspace
|
||||
description: Primary workspace location and important paths
|
||||
metadata:
|
||||
node_type: memory
|
||||
type: project
|
||||
originSessionId: a1ac522e-9103-4757-b6d0-a7cd2f5681fb
|
||||
---
|
||||
|
||||
Primary workspace: /root
|
||||
|
||||
Plugin source: /boot/config/plugins/varaverk (on Unraid USB — persists across reboots)
|
||||
|
||||
Key files:
|
||||
- /boot/config/plugins/varaverk/Notes_To-Do.md — running notes and design ideas
|
||||
- /boot/config/plugins/varaverk/README.md — full project documentation
|
||||
- /boot/config/plugins/varaverk/Manual.md — manual
|
||||
- /boot/config/plugins/varaverk/common.sh — shared library
|
||||
- /boot/config/plugins/varaverk/schedule.json — scheduling config
|
||||
- /boot/config/plugins/varaverk/varaverk.cron — cron config
|
||||
|
||||
**Why:** /boot is the Unraid USB drive and survives reboots/reinstalls. /root does not persist without explicit setup.
|
||||
**How to apply:** Always look at /boot/config/plugins/varaverk for the authoritative source. Notes and docs there survive power outages.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Memory Index
|
||||
|
||||
- [Workspace](workspace.md) — primary workspace is /root; plugin lives at /boot/config/plugins/varaverk
|
||||
- [Project: Varaverk](project_varaverk.md) — self-healing two-server Unraid home media ecosystem
|
||||
- [User Profile](user_profile.md) — user context and preferences
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Unraid management utility
|
||||
/usr/local/sbin/emhttp
|
||||
|
||||
# Wait for PCI/USB initialization
|
||||
sleep 5
|
||||
|
||||
# Stub the ITE USB hub PCI controller
|
||||
echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
|
||||
echo "vfio-pci" > /sys/bus/pci/devices/0000:01:00.0/driver_override
|
||||
echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/bind
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Unraid management utility
|
||||
/usr/local/sbin/emhttp
|
||||
|
||||
# Restore Claude Code persistent memory
|
||||
ln -sfn /boot/config/claude /root/.claude
|
||||
|
||||
# Wait for PCI/USB initialization
|
||||
sleep 5
|
||||
|
||||
# Stub the ITE USB hub PCI controller
|
||||
echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
|
||||
echo "vfio-pci" > /sys/bus/pci/devices/0000:01:00.0/driver_override
|
||||
echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/bind
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Unraid management utility
|
||||
/usr/local/sbin/emhttp
|
||||
|
||||
# Wait for PCI/USB initialization
|
||||
sleep 5
|
||||
|
||||
# Stub the ITE USB hub PCI controller
|
||||
echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
|
||||
echo "vfio-pci" > /sys/bus/pci/devices/0000:01:00.0/driver_override
|
||||
echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/bind
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Unraid management utility
|
||||
/usr/local/sbin/emhttp
|
||||
|
||||
# Add ~/.local/bin to PATH for all terminal sessions (Claude Code lives here)
|
||||
echo 'export PATH="$HOME/.local/bin:$PATH"' > /etc/profile.d/local_bin_path.sh
|
||||
|
||||
# Wait for PCI/USB initialization
|
||||
sleep 5
|
||||
|
||||
# Stub the ITE USB hub PCI controller
|
||||
echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
|
||||
echo "vfio-pci" > /sys/bus/pci/devices/0000:01:00.0/driver_override
|
||||
echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/bind
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Unraid management utility
|
||||
/usr/local/sbin/emhttp
|
||||
|
||||
# Add ~/.local/bin to PATH for all terminal sessions (Claude Code lives here)
|
||||
echo 'export PATH="$HOME/.local/bin:$PATH"' > /etc/profile.d/local_bin_path.sh
|
||||
echo 'export PATH="$HOME/.local/bin:$PATH"' >> /root/.bashrc
|
||||
|
||||
# Wait for PCI/USB initialization
|
||||
sleep 5
|
||||
|
||||
# Stub the ITE USB hub PCI controller
|
||||
echo "0000:01:00.0" > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
|
||||
echo "vfio-pci" > /sys/bus/pci/devices/0000:01:00.0/driver_override
|
||||
echo "0000:01:00.0" > /sys/bus/pci/drivers/vfio-pci/bind
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+114
@@ -0,0 +1,114 @@
|
||||
#!/bin/bash
|
||||
# ==============================================================================================
|
||||
# ================================= Claude Code Startup ========================================
|
||||
# ==============================================================================================
|
||||
#
|
||||
# PURPOSE
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Restores Claude Code's persistent data after an Unraid reboot and launches Claude.
|
||||
# Unraid's root filesystem lives in RAM — /root/.claude and /root/.local are wiped on
|
||||
# every reboot. This script symlinks both directories back to persistent appdata storage
|
||||
# before launching Claude, so memory, sessions, and settings survive across reboots.
|
||||
#
|
||||
# On first run with no existing persistent data, migrates from the current live locations:
|
||||
# /root/.claude → PERSIST_DIR/.claude (memory, sessions, settings)
|
||||
# /root/.local/share/claude → PERSIST_DIR/local/share/claude (installed binaries)
|
||||
# Subsequent runs skip the migration and only create the symlinks.
|
||||
#
|
||||
# Standalone script — no common.sh dependency. Safe to run directly from terminal
|
||||
# or from array_started.sh.
|
||||
#
|
||||
# ==============================================================================================
|
||||
# RUNTIME MODES
|
||||
# ==============================================================================================
|
||||
#
|
||||
# claude_startup.sh
|
||||
# Set up persistent symlinks and launch Claude.
|
||||
#
|
||||
# claude_startup.sh --setup
|
||||
# Set up persistent symlinks only — do not launch Claude.
|
||||
# Used by array_started.sh to prepare the environment on boot without
|
||||
# immediately launching an interactive session.
|
||||
#
|
||||
# ==============================================================================================
|
||||
|
||||
PERSIST_DIR="/mnt/user/appdata/claude-code"
|
||||
CLAUDE_DATA="$PERSIST_DIR/.claude"
|
||||
CLAUDE_BIN="$PERSIST_DIR/local/share/claude"
|
||||
|
||||
LAUNCH=true
|
||||
[[ "$1" == "--setup" ]] && LAUNCH=false
|
||||
|
||||
# Standalone — no common.sh dependency
|
||||
_log() { echo " ✅ $*"; }
|
||||
_warn() { echo " ⚠️ $*"; }
|
||||
_err() { echo " ❌ $*" >&2; }
|
||||
|
||||
echo ""
|
||||
echo "━━━ Claude Code Startup ━━━"
|
||||
echo ""
|
||||
|
||||
# ── Array must be mounted ─────────────────────────────────────────────────────────────────────
|
||||
if ! mountpoint -q /mnt/user 2>/dev/null; then
|
||||
_err "Array not mounted — /mnt/user not available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ── Create persistent dirs ────────────────────────────────────────────────────────────────────
|
||||
mkdir -p "$CLAUDE_DATA" "$CLAUDE_BIN"
|
||||
|
||||
# ── Migrate .claude on first run ──────────────────────────────────────────────────────────────
|
||||
if [[ ! -L /root/.claude && -d /root/.claude ]]; then
|
||||
_warn "First run — migrating /root/.claude → $CLAUDE_DATA"
|
||||
cp -a /root/.claude/. "$CLAUDE_DATA/"
|
||||
rm -rf /root/.claude
|
||||
_log "Migrated .claude (memory, sessions, settings)"
|
||||
elif [[ -z "$(ls -A "$CLAUDE_DATA" 2>/dev/null)" && -d /root/.claude ]]; then
|
||||
_warn "Persistent storage empty — copying current .claude data"
|
||||
cp -a /root/.claude/. "$CLAUDE_DATA/"
|
||||
_log "Copied .claude data to persistent storage"
|
||||
fi
|
||||
|
||||
# ── Migrate Claude binaries on first run ──────────────────────────────────────────────────────
|
||||
if [[ ! -L /root/.local/share/claude && -d /root/.local/share/claude ]]; then
|
||||
_warn "First run — migrating Claude binaries → $CLAUDE_BIN"
|
||||
cp -a /root/.local/share/claude/. "$CLAUDE_BIN/"
|
||||
_log "Migrated Claude binaries"
|
||||
fi
|
||||
|
||||
# ── Create symlinks ───────────────────────────────────────────────────────────────────────────
|
||||
# Remove any real directories first — ln -sfn silently creates inside a dir instead of
|
||||
# replacing it, which produces a circular symlink on subsequent runs after migration.
|
||||
mkdir -p /root/.local/share /root/.local/bin
|
||||
|
||||
[[ -d /root/.claude && ! -L /root/.claude ]] && rm -rf /root/.claude
|
||||
ln -sfn "$CLAUDE_DATA" /root/.claude
|
||||
_log ".claude → $CLAUDE_DATA"
|
||||
|
||||
[[ -d /root/.local/share/claude && ! -L /root/.local/share/claude ]] && rm -rf /root/.local/share/claude
|
||||
ln -sfn "$CLAUDE_BIN" /root/.local/share/claude
|
||||
_log "claude binary → $CLAUDE_BIN"
|
||||
|
||||
# ── Point the claude binary at the latest installed version ───────────────────────────────────
|
||||
LATEST=$(ls "$CLAUDE_BIN/versions/" 2>/dev/null | sort -V | tail -1)
|
||||
if [[ -z "$LATEST" ]]; then
|
||||
_err "No Claude versions found in $CLAUDE_BIN/versions/"
|
||||
_err "Install Claude Code first: npm install -g @anthropic-ai/claude-code"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ln -sfn "$CLAUDE_BIN/versions/$LATEST" /root/.local/bin/claude
|
||||
_log "claude v$LATEST ready"
|
||||
|
||||
echo ""
|
||||
|
||||
# ── Setup-only mode (used by array_started.sh or other callers) ─────────────────────────────────
|
||||
if [[ "$LAUNCH" == false ]]; then
|
||||
_log "Setup complete — run 'claude' to start"
|
||||
echo ""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ── Launch ────────────────────────────────────────────────────────────────────────────────────
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
exec claude
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
# ==============================================================================================
|
||||
# ================================= Claude Code Startup ========================================
|
||||
# ==============================================================================================
|
||||
#
|
||||
# PURPOSE
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Restores Claude Code's persistent data after an Unraid reboot and launches Claude.
|
||||
# Unraid's root filesystem lives in RAM — /root/.claude and /root/.local are wiped on
|
||||
# every reboot. This script symlinks both directories back to persistent appdata storage
|
||||
# before launching Claude, so memory, sessions, and settings survive across reboots.
|
||||
#
|
||||
# On first run with no existing persistent data, migrates from the current live locations:
|
||||
# /root/.claude → PERSIST_DIR/.claude (memory, sessions, settings)
|
||||
# /root/.local/share/claude → PERSIST_DIR/local/share/claude (installed binaries)
|
||||
# Subsequent runs skip the migration and only create the symlinks.
|
||||
#
|
||||
# Standalone script — no common.sh dependency. Safe to run directly from terminal
|
||||
# or from array_started.sh.
|
||||
#
|
||||
# ==============================================================================================
|
||||
# RUNTIME MODES
|
||||
# ==============================================================================================
|
||||
#
|
||||
# claude_startup.sh
|
||||
# Set up persistent symlinks only — default, used by array_started.sh on boot.
|
||||
#
|
||||
# claude_startup.sh --launch
|
||||
# Set up persistent symlinks and launch Claude interactively.
|
||||
#
|
||||
# ==============================================================================================
|
||||
|
||||
PERSIST_DIR="/mnt/user/appdata/claude-code"
|
||||
CLAUDE_DATA="$PERSIST_DIR/.claude"
|
||||
CLAUDE_BIN="$PERSIST_DIR/local/share/claude"
|
||||
|
||||
LAUNCH=false
|
||||
[[ "$1" == "--launch" ]] && LAUNCH=true
|
||||
|
||||
# Standalone — no common.sh dependency
|
||||
_log() { echo " ✅ $*"; }
|
||||
_warn() { echo " ⚠️ $*"; }
|
||||
_err() { echo " ❌ $*" >&2; }
|
||||
|
||||
echo ""
|
||||
echo "━━━ Claude Code Startup ━━━"
|
||||
echo ""
|
||||
|
||||
# ── Array must be mounted ─────────────────────────────────────────────────────────────────────
|
||||
if ! mountpoint -q /mnt/user 2>/dev/null; then
|
||||
_err "Array not mounted — /mnt/user not available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ── Create persistent dirs ────────────────────────────────────────────────────────────────────
|
||||
mkdir -p "$CLAUDE_DATA" "$CLAUDE_BIN"
|
||||
|
||||
# ── Migrate .claude on first run ──────────────────────────────────────────────────────────────
|
||||
if [[ ! -L /root/.claude && -d /root/.claude ]]; then
|
||||
_warn "First run — migrating /root/.claude → $CLAUDE_DATA"
|
||||
cp -a /root/.claude/. "$CLAUDE_DATA/"
|
||||
rm -rf /root/.claude
|
||||
_log "Migrated .claude (memory, sessions, settings)"
|
||||
elif [[ -z "$(ls -A "$CLAUDE_DATA" 2>/dev/null)" && -d /root/.claude ]]; then
|
||||
_warn "Persistent storage empty — copying current .claude data"
|
||||
cp -a /root/.claude/. "$CLAUDE_DATA/"
|
||||
_log "Copied .claude data to persistent storage"
|
||||
fi
|
||||
|
||||
# ── Migrate Claude binaries on first run ──────────────────────────────────────────────────────
|
||||
if [[ ! -L /root/.local/share/claude && -d /root/.local/share/claude ]]; then
|
||||
_warn "First run — migrating Claude binaries → $CLAUDE_BIN"
|
||||
cp -a /root/.local/share/claude/. "$CLAUDE_BIN/"
|
||||
_log "Migrated Claude binaries"
|
||||
fi
|
||||
|
||||
# ── Create symlinks ───────────────────────────────────────────────────────────────────────────
|
||||
# Remove any real directories first — ln -sfn silently creates inside a dir instead of
|
||||
# replacing it, which produces a circular symlink on subsequent runs after migration.
|
||||
mkdir -p /root/.local/share /root/.local/bin
|
||||
|
||||
[[ -d /root/.claude && ! -L /root/.claude ]] && rm -rf /root/.claude
|
||||
ln -sfn "$CLAUDE_DATA" /root/.claude
|
||||
_log ".claude → $CLAUDE_DATA"
|
||||
|
||||
[[ -d /root/.local/share/claude && ! -L /root/.local/share/claude ]] && rm -rf /root/.local/share/claude
|
||||
ln -sfn "$CLAUDE_BIN" /root/.local/share/claude
|
||||
_log "claude binary → $CLAUDE_BIN"
|
||||
|
||||
# ── Point the claude binary at the latest installed version ───────────────────────────────────
|
||||
LATEST=$(ls "$CLAUDE_BIN/versions/" 2>/dev/null | sort -V | tail -1)
|
||||
if [[ -z "$LATEST" ]]; then
|
||||
_err "No Claude versions found in $CLAUDE_BIN/versions/"
|
||||
_err "Install Claude Code first: npm install -g @anthropic-ai/claude-code"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ln -sfn "$CLAUDE_BIN/versions/$LATEST" /root/.local/bin/claude
|
||||
_log "claude v$LATEST ready"
|
||||
|
||||
echo ""
|
||||
|
||||
# ── Setup-only mode (used by array_started.sh or other callers) ─────────────────────────────────
|
||||
if [[ "$LAUNCH" == false ]]; then
|
||||
_log "Setup complete — run 'claude' to start"
|
||||
echo ""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ── Launch ────────────────────────────────────────────────────────────────────────────────────
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
exec claude
|
||||
Reference in New Issue
Block a user