refactor: rename failover/HA → fallback across entire codebase

Removes all references to "failover" and "HA" (high availability)
terminology from variable names, config keys, state values, rsync
profile names, directory paths, and user-visible strings.

Mapping:
  FAILOVER_*              → FALLBACK_*
  FAILOVER_HOST*_RUNS_FOR → FALLBACK_HOST*_COVERS
  critical-failover       → critical-fallback
  emby-failover           → emby-fallback
  appdata-Failover/       → appdata-Fallback/
  "FAILOVER" state value  → "FALLBACK"
  failover_start key      → fallback_start
  Failover/ directory     → Fallback/
  failover.sh             → fallback.sh
  failover_state.db       → fallback_state.db
  -Failover folder suffix → -Fallback

State machine: NORMAL | FALLBACK | DARK (unchanged)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gmer4Lfe
2026-05-08 19:28:21 -04:00
co-authored by Claude Sonnet 4.6
parent 4e22f5d1f7
commit 009820e981
19 changed files with 517 additions and 416 deletions
+2 -2
View File
@@ -20,7 +20,7 @@
# CONTINUOUS (run until array stops):
# unRAID_Essentials/system_watchdog.sh — system health monitor (last line of defense)
# Docker_Essentials/docker_watchdog.sh — container health monitor
# Failover/failover.sh — mutual failover monitor
# Fallback/fallback.sh — mutual failover monitor
#
# ── WHY ORDER MATTERS ─────────────────────────────────────────────────────────────────────────
# inotify_tuning.sh — must run BEFORE Code-Server and other containers start
@@ -30,7 +30,7 @@
# docker_network_connect — must run BEFORE watchdogs check container states
# system_watchdog.sh — before docker_watchdog (system > container priority)
# docker_watchdog.sh — before failover (containers must be healthy for failover)
# failover.sh — last — needs everything else stable to make decisions
# fallback.sh — last — needs everything else stable to make decisions
#
# ── ONE-SHOT vs CONTINUOUS DETECTION ─────────────────────────────────────────────────────────
# Script is launched in background with bash script.sh &
+1 -1
View File
@@ -8,7 +8,7 @@
#
# ── EXECUTION ORDER ───────────────────────────────────────────────────────────────────────────
# 1. Critical-Data rsync — auth stack, NPM config, certs (containers stopped both sides)
# 2. emby-failover rsync — dirty Emby sync (watch states, library — Emby stays running)
# 2. emby-fallback rsync — dirty Emby sync (watch states, library — Emby stays running)
# 3. CRITICAL_MAINTENANCE_SCRIPTS — any scripts configured for critical window
# 4. partnership --check — read both state files, detect changes, act accordingly
#
+15 -15
View File
@@ -14,7 +14,7 @@
# 🎬 Transcodes — ramdisk usage, weekly peak, flips, session split
# 🎵 Media Activity — arr cleanup stats, arr recovery stats, queue depth
# 🌐 Rsync — weekly transfer totals, per-share breakdown, failures
# 🛡️ Watchdog — system watchdog, docker watchdog, failover state
# 🛡️ Watchdog — system watchdog, docker watchdog, fallback state
# 🔐 Security — SSL cert expiry per domain
# 📊 Emby — weekly stream count, active now, top users
# ⚙️ System Health — SMART summary, inotify, php-fpm, Docker, Gitea sync
@@ -22,7 +22,7 @@
#
# ── DATA SOURCES (reads only) ─────────────────────────────────────────────────────────────────
# DATA_DIR stats files — arr cleanup, recovery, transcode, bandwidth history
# /boot/config — failover state, watchdog reboot log
# /boot/config — fallback state, watchdog reboot log
# /tmp — watchdog strike state files
# /proc, /sys — system memory, uptime, inotify
# /var/local/emhttp/ — unRAID array info
@@ -113,7 +113,7 @@ if [[ "$SHOW_STATUS" == true ]]; then
"$SYS_WATCHDOG_REBOOT_LOG:watchdog reboot log" \
"$WATCHDOG_STATE_FILE:docker watchdog state" \
"$WATCHDOG_CONTAINER_RESTART_LOG:container restart log" \
"$FAILOVER_STATE_FILE:failover state"; do
"$FALLBACK_STATE_FILE:fallback state"; do
path="${f%%:*}"
label="${f##*:}"
if [[ -f "$path" ]] && [[ -s "$path" ]]; then
@@ -578,22 +578,22 @@ fi
REPORT+=("")
# ── Failover ─────────────────────────────────────────────────────────────────────────────────
line "🔀 Failover"
FO_PID=$(_get_lock_pid "failover")
if _is_running "failover"; then
FO_AGE=$(_lock_age "failover")
line "🔀 Fallback"
FO_PID=$(_get_lock_pid "fallback")
if _is_running "fallback"; then
FO_AGE=$(_lock_age "fallback")
line " ✅ Running │ PID: $FO_PID │ Uptime: $(_fmt_uptime "$FO_AGE")"
elif [[ "${FAILOVER_ENABLED:-true}" == false ]]; then
line " ⏸️ Not running — FAILOVER_ENABLED=false"
elif [[ "${FALLBACK_ENABLED:-true}" == false ]]; then
line " ⏸️ Not running — FALLBACK_ENABLED=false"
else
issue "failover NOT RUNNING"
issue "fallback NOT RUNNING"
fi
FO_STATE="UNKNOWN"
FO_STATE_SECS=0
if [[ -f "$FAILOVER_STATE_FILE" ]]; then
FO_STATE=$(grep "^state=" "$FAILOVER_STATE_FILE" 2>/dev/null | cut -d= -f2)
FO_EPOCH=$(grep "^last_change_epoch=" "$FAILOVER_STATE_FILE" 2>/dev/null | cut -d= -f2)
if [[ -f "$FALLBACK_STATE_FILE" ]]; then
FO_STATE=$(grep "^state=" "$FALLBACK_STATE_FILE" 2>/dev/null | cut -d= -f2)
FO_EPOCH=$(grep "^last_change_epoch=" "$FALLBACK_STATE_FILE" 2>/dev/null | cut -d= -f2)
[[ -n "$FO_EPOCH" ]] && FO_STATE_SECS=$(( NOW - FO_EPOCH ))
fi
@@ -602,8 +602,8 @@ FO_DUR=$(_fmt_uptime "${FO_STATE_SECS:-0}")
case "$FO_STATE" in
NORMAL)
line " ✅ State: NORMAL │ Duration: $FO_DUR" ;;
FAILOVER)
issue " State: FAILOVER$REMOTE_SERVER_NAME down for $FO_DUR"
FALLBACK)
issue " State: FALLBACK$REMOTE_SERVER_NAME down for $FO_DUR"
FO_MINS=$(( FO_STATE_SECS / 60 ))
# Use REMOTE_ID-based tier delay vars — no HOST1/HOST2 hardcoding
T2_VAR="${REMOTE_ID}_TIER2_DELAY"; T3_VAR="${REMOTE_ID}_TIER3_DELAY"; T4_VAR="${REMOTE_ID}_TIER4_DELAY"
+1 -1
View File
@@ -19,7 +19,7 @@
# Emby builds a warm image cache on HOST2 throughout the week.
# Syncing nightly resets cache — cold loads every morning for users.
# Weekly sync: cache stays warm 6 days, resets Sunday night while users sleep.
# emby-failover dirty sync covers watch states + library every 15min between weekly syncs.
# emby-fallback dirty sync covers watch states + library every 15min between weekly syncs.
#
# ── CONTAINER UPDATES ─────────────────────────────────────────────────────────────────────────
# Containers already stopped for sync — updates pull at zero extra downtime.