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
+35 -35
View File
@@ -49,7 +49,7 @@
#
# ── FAILOVER ───────────────────────────────────────────────────────────────────────────────
# FAILOVER Mutual container failover shared settings
# FAILOVER TEST Simulated outage settings for failover_test.sh
# FALLBACK TEST Simulated outage settings for fallback_test.sh
#
# ── DOCKER ESSENTIALS ──────────────────────────────────────────────────────────────────────
# DOWNLOADERS RESET Retention and thresholds for slskd, SABnzbd, qBittorrent
@@ -99,7 +99,7 @@
# DATA_DIR is the same path on all servers — persistent script state and statistics.
# Array share — survives reboots, no flash drive wear.
# Created automatically if it doesn't exist.
# Only truly critical files (failover state, watchdog reboot log) stay on /boot/config.
# Only truly critical files (fallback state, watchdog reboot log) stay on /boot/config.
DATA_DIR="/mnt/user/appdata/unraid_scripts/data"
# ── Version Parity ──
@@ -254,7 +254,7 @@
"Docker_Essentials/docker_network_connect.sh" # ensure networks exist + connect containers
"unRAID_Essentials/system_watchdog.sh" # system health monitor — continuous loop
"Docker_Essentials/docker_watchdog.sh" # container health monitor — continuous loop
# "Failover/failover.sh" # mutual failover — enable when HOST2 ready
# "Fallback/fallback.sh" # mutual failover — enable when HOST2 ready
)
# ━━━ Daily Sync Maintenance ━━━
@@ -352,14 +352,14 @@
# DAILY_RSYNC_ENABLED=false ← skip daily HDD syncs during rebuild
# WEEKLY_RSYNC_ENABLED=true ← Emby + Critical-Data still sync (NVMe)
# CRITICAL_RSYNC_ENABLED=true ← 15min auth stack sync still runs
# FAILOVER_RSYNC_ENABLED=true ← handback writeback still works
# FALLBACK_RSYNC_ENABLED=true ← handback writeback still works
# → Run individual: bash Rsync/rsync.sh /mnt/user/Movies
# → When ready: DAILY_RSYNC_ENABLED=true
RSYNC_ENABLED=true # Tier 1 — global gate, overrides everything below
DAILY_RSYNC_ENABLED=false # Tier 2 — HOST2 rebuild in progress, re-enable when ready
WEEKLY_RSYNC_ENABLED=true # Tier 2 — weekly_sync_maintenance.sh rsync section
CRITICAL_RSYNC_ENABLED=false # Tier 2 — disabled during HOST2 rebuild, re-enable when ready
FAILOVER_RSYNC_ENABLED=true # Tier 2 — failover.sh writeback jobs on handback
FALLBACK_RSYNC_ENABLED=true # Tier 2 — fallback.sh writeback jobs on handback
# ━━━ Rsync Defaults ━━━
# Global fallback values used when no profile match is found.
@@ -395,53 +395,53 @@
# arrs_stack — arr databases — lower bandwidth, containers stopped for consistency
# critical-data — auth stack — full stop both sides, Authelia delayed start
# called by weekly_sync_maintenance.sh — full clean sync weekly
# critical-failover — dirty sync — auth stays running both sides, WAL excluded
# critical-fallback — dirty sync — auth stays running both sides, WAL excluded
# called by critical_sync_maintenance.sh every 15min
# host1-appdata — HOST1 server-specific appdata — defined in master_host1.conf
# host2-appdata — HOST2 server-specific appdata — defined in master_host2.conf
# important-data — NextCloud + Postgres — NextCloud delayed start after Postgres
# emby — weekly clean sync — both Emby stopped, full mirror
# called by weekly_sync_maintenance.sh only — do NOT schedule separately
# emby-failover — dirty sync — Emby stays running, WAL excluded
# emby-fallback — dirty sync — Emby stays running, WAL excluded
# called by critical_sync_maintenance.sh every 15min
declare -A PROFILE_RSYNC_OPTS=(
[arrs_stack]="-av --info=progress2 --human-readable --bwlimit=$BW_LIMIT --delete --inplace"
[critical-data]="-av --human-readable --bwlimit=$BW_LIMIT --delete"
[critical-failover]="-av --human-readable --bwlimit=$BW_LIMIT --delete --inplace --no-whole-file"
[critical-fallback]="-av --human-readable --bwlimit=$BW_LIMIT --delete --inplace --no-whole-file"
[important-data]="-av --human-readable --bwlimit=$BW_LIMIT"
[emby]="-av --human-readable --bwlimit=$BW_LIMIT --delete --inplace --no-whole-file"
[emby-failover]="-av --human-readable --bwlimit=$BW_LIMIT --delete --inplace --no-whole-file"
[emby-fallback]="-av --human-readable --bwlimit=$BW_LIMIT --delete --inplace --no-whole-file"
)
# Per-profile bandwidth limits in KB/s
declare -A PROFILE_BW_LIMIT=(
[arrs_stack]=5000 # lower — runs alongside other syncs
[critical-data]=9500 # high — small dataset, sync fast
[critical-failover]=9500 # high — small dataset, sync fast
[critical-fallback]=9500 # high — small dataset, sync fast
[important-data]=9500 # high — database sync
[emby]=8000 # medium — large full mirror
[emby-failover]=9500 # high — small critical dataset
[emby-fallback]=9500 # high — small critical dataset
)
# Retry attempts per profile
declare -A PROFILE_RETRY_COUNT=(
[arrs_stack]=3
[critical-data]=3
[critical-failover]=3
[critical-fallback]=3
[important-data]=3
[emby]=3
[emby-failover]=3
[emby-fallback]=3
)
# Seconds between retry attempts
declare -A PROFILE_SLEEP=(
[arrs_stack]=300
[critical-data]=300
[critical-failover]=120 # shorter — frequent dirty sync, retry faster
[critical-fallback]=120 # shorter — frequent dirty sync, retry faster
[important-data]=300
[emby]=300
[emby-failover]=120 # shorter — frequent dirty sync, retry faster
[emby-fallback]=120 # shorter — frequent dirty sync, retry faster
)
# Containers stopped on BOTH LOCAL and REMOTE before rsync.
@@ -451,10 +451,10 @@
declare -A PROFILE_CRITICAL_CONTAINER_NAMES=(
[arrs_stack]="Sonarr Lidarr Readarr Radarr Prowlarr Bazarr Pinchflat"
[critical-data]="Mariadb-Authelia Mariadb-Authelia-Secondary Redis-Authelia Redis-Authelia-Secondary Lldap-Gmer4Lfe NginxProxyManager Authelia Authelia-Secondary"
[critical-failover]="" # dirty sync — auth stays running both sides
[critical-fallback]="" # dirty sync — auth stays running both sides
[important-data]="Postgres-NextCloud NextCloud"
[emby]="Emby"
[emby-failover]="" # dirty sync — Emby stays running both sides
[emby-fallback]="" # dirty sync — Emby stays running both sides
)
# Containers needing a delay after rsync before starting.
@@ -462,20 +462,20 @@
declare -A PROFILE_DELAYED_CONTAINERS=(
[arrs_stack]=""
[critical-data]="Authelia Authelia-Secondary" # wait for Mariadb + Redis
[critical-failover]=""
[critical-fallback]=""
[important-data]="NextCloud" # wait for Postgres
[emby]=""
[emby-failover]=""
[emby-fallback]=""
)
# Seconds before starting delayed containers
declare -A PROFILE_CONTAINER_DELAY=(
[arrs_stack]=5
[critical-data]=15 # Mariadb + Redis need time to accept connections
[critical-failover]=5
[critical-fallback]=5
[important-data]=10 # Postgres needs time before NextCloud
[emby]=5
[emby-failover]=5
[emby-fallback]=5
)
# Directories excluded from rsync per profile.
@@ -483,19 +483,19 @@
declare -A PROFILE_EXCLUDE_DIRS=(
[arrs_stack]="logs *.tmp"
[critical-data]="logs *.tmp *.log nginx/temp nginx/cache __pycache__ notification.txt"
[critical-failover]="logs *.tmp *.log nginx/temp nginx/cache __pycache__ notification.txt *.db-wal *.db-shm"
[critical-fallback]="logs *.tmp *.log nginx/temp nginx/cache __pycache__ notification.txt *.db-wal *.db-shm"
[important-data]="logs *.tmp"
[emby]="logs transcodes cache crash*"
[emby-failover]="logs transcodes cache metadata *.db-wal *.db-shm crash* plugins root"
[emby-fallback]="logs transcodes cache metadata *.db-wal *.db-shm crash* plugins root"
)
# Remote restart after dirty sync — restart these on remote IF they were running before sync.
# Same logic as stop/start — was stopped = stays stopped, was running = gets restarted.
# Used by dirty sync profiles (critical-failover, emby-failover) so remote picks up changes.
# Used by dirty sync profiles (critical-fallback, emby-fallback) so remote picks up changes.
# SPACE-SEPARATED STRINGS — converted to array at runtime
declare -A PROFILE_REMOTE_RESTART_CONTAINERS=(
[critical-failover]="NginxProxyManager Authelia Authelia-Secondary Lldap-Gmer4Lfe Mariadb-Authelia Mariadb-Authelia-Secondary Redis-Authelia Redis-Authelia-Secondary"
[emby-failover]="Emby"
[critical-fallback]="NginxProxyManager Authelia Authelia-Secondary Lldap-Gmer4Lfe Mariadb-Authelia Mariadb-Authelia-Secondary Redis-Authelia Redis-Authelia-Secondary"
[emby-fallback]="Emby"
)
# Note: disk check is auto-detected from disks.ini — no PROFILE_SKIP_DISK_CHECK needed.
@@ -505,7 +505,7 @@
# ── FAILOVER ──────────────────────────────────────────────────────────────────────────────────
# ==============================================================================================
# Mutual container failover between two unRAID servers.
# Each server runs Failover/failover.sh independently via array_start.sh.
# Each server runs Fallback/fallback.sh independently via array_start.sh.
# All decisions based on two pings: remote reachable + internet reachable.
#
# States: NORMAL | FAILOVER | NO_INTERNET | DARK
@@ -519,16 +519,16 @@
# Shared settings (intervals, state file, thresholds) live here.
EXTERNAL_IP="8.8.8.8"
FAILOVER_CHECK_INTERVAL=120 # seconds between failover state checks
FAILOVER_HANDBACK_STRIKES=2 # consecutive healthy checks before initiating handback
FAILOVER_STATE_FILE="/boot/config/failover_state.db"
FAILOVER_ENABLED=false # HOST2 being rebuilt — set true when back online and tested
FALLBACK_CHECK_INTERVAL=120 # seconds between fallback state checks
FALLBACK_HANDBACK_STRIKES=2 # consecutive healthy checks before initiating handback
FALLBACK_STATE_FILE="/boot/config/fallback_state.db"
FALLBACK_ENABLED=false # HOST2 being rebuilt — set true when back online and tested
# false = suppresses "not running" warnings in status scripts
# ━━━ Failover Test ━━━
# Controlled simulation of a failover event — run manually via failover_test.sh.
FAILOVER_TEST_BLOCK_WAIT=150 # seconds to wait after blocking connectivity
FAILOVER_TEST_HANDBACK_WAIT=360 # seconds to wait before initiating handback
# Controlled simulation of a failover event — run manually via fallback_test.sh.
FALLBACK_TEST_BLOCK_WAIT=150 # seconds to wait after blocking connectivity
FALLBACK_TEST_HANDBACK_WAIT=360 # seconds to wait before initiating handback
# ==============================================================================================
# ── DOCKER ESSENTIALS ─────────────────────────────────────────────────────────────────────────
@@ -1046,7 +1046,7 @@
DIGEST_PROFILE="weekly" # always | smart | weekly
DIGEST_DAY="Sunday"
DIGEST_SMART_ON_WATCHDOG=true # send if any watchdog strikes are active
DIGEST_SMART_ON_FAILOVER=true # send if failover state is not NORMAL
DIGEST_SMART_ON_FALLBACK=true # send if fallback state is not NORMAL
DIGEST_SMART_ON_CERT_WARN=true # send if any cert is under CERT_WARN_DAYS
DIGEST_SMART_ON_BANDWIDTH=true # send if any transfer exceeded BANDWIDTH_WARN_GB