small fixes

This commit is contained in:
2026-04-15 17:58:25 -04:00
parent 630c863cd7
commit c37f7adac6
6 changed files with 871 additions and 55 deletions
+29 -48
View File
@@ -53,7 +53,7 @@
# ── TRANSCODES ─────────────────────────────────────────────────────────────────────────────
# TRANSCODE MANAGER Ramdisk and SSD fallback transcode management
#
# ── MONITOR ────────────────────────────────────────────────────────────────────────────────
# ── MONITORS ────────────────────────────────────────────────────────────────────────────────
# CERTIFICATE MONITOR SSL certificate expiry monitoring
# BACKUP VERIFY Random sample checksum verification against remote
# SMART HEALTH Drive SMART attribute monitoring
@@ -294,83 +294,64 @@ declare -A PROFILE_SKIP_DISK_CHECK=(
# Each server runs Failover/failover.sh independently — no coordination between servers.
# All decisions are based solely on two ping checks: remote reachable + internet reachable.
#
# How it works:
# Every FAILOVER_CHECK_INTERVAL seconds each server pings the remote and pings the internet.
# Based on those two results it determines its state and takes the appropriate action.
# No SSH, no signaling — each server acts autonomously based only on what it can see.
#
# States:
# NORMAL — remote up, internet up — own containers only, silent operation
# FAILOVER — remote down, internet up — start remote's containers locally (additive)
# Own normal containers keep running — failover containers added on top
# NO_INTERNET — internet down — stop public-facing containers, wait for recovery
# DARK — remote down + internet down — same actions as NO_INTERNET
#
# Handback sequence when remote returns after FAILOVER:
# 1. Strike confirmation — FAILOVER_HANDBACK_STRIKES consecutive remote-up checks
# Prevents handing back during a brief network blip
# 2. Pre-flight checks — remote array started, Docker daemon healthy, rootfs not full
# 3. Rsync data back via rsync.sh — uses existing profile system for options
# 4. Start failover containers on remote via SSH
# 5. Stop failover containers locally — only after remote confirmed started
# 6. Return to NORMAL state
#
# Script runs on BOTH servers — detect_hosts() selects the correct arrays automatically.
# Comment out any container or rsync job to disable without removing the entry.
# Handback: strike confirmation → pre-flight → rsync → start remote → stop local
EXTERNAL_IP="8.8.8.8" # external IP to ping for internet connectivity check
FAILOVER_CHECK_INTERVAL=120 # seconds between state checks — 120s = 2 minute polling
FAILOVER_HANDBACK_STRIKES=2 # consecutive remote-up confirmations required before handback
# 2 strikes at 120s interval = 4 minutes confirmation window
FAILOVER_CHECK_INTERVAL=120 # seconds between state checks
FAILOVER_HANDBACK_STRIKES=2 # consecutive remote-up confirmations before handback
FAILOVER_STATE_FILE="/boot/config/failover_state.db"
# persists on /boot/ so it survives reboots
# script re-evaluates from live pings on restart
# ━━━ HOST1 Failover Config (unRAID-Gmer4Lfe — Primary) ━━━
# Containers HOST1 starts locally when HOST2 goes down.
# These run ON TOP OF HOST1's normal containers — additive, not a replacement.
# ━━━ Failover Test ━━━
# Used by Failover/failover_test.sh — controlled simulation of the failover lifecycle.
# failover_test.sh blocks remote connectivity via iptables then observes failover.sh behavior.
# All failover logic stays in failover.sh — test script is the harness only.
#
# ⚠️ Run during a maintenance window — real containers start and stop during the test.
# Use --dry-run first to walk through phases without touching anything.
# Seconds to hold the iptables block — must be longer than FAILOVER_CHECK_INTERVAL
# so failover.sh has time to detect the outage and change state
FAILOVER_TEST_BLOCK_WAIT=150 # 150s = FAILOVER_CHECK_INTERVAL + 30s buffer
# Seconds to wait for handback after restoring connectivity
# Must cover FAILOVER_HANDBACK_STRIKES x FAILOVER_CHECK_INTERVAL plus rsync time
# 2 strikes x 120s = 240s minimum — add buffer for rsync handback jobs
FAILOVER_TEST_HANDBACK_WAIT=360 # 360s = 6 minutes — adjust if rsync takes longer
FAILOVER_HOST1_STARTS_FOR_HOST2=(
"Gmer4Lfe.com"
"Gmer4Lfe.us"
)
# Containers HOST1 stops when it loses internet connectivity.
# No point serving DDNS or public services if HOST1 itself has no internet.
FAILOVER_HOST1_STOP_ON_NO_NET=(
"Gmer4Lfe.com"
"Gmer4Lfe.us"
)
# Rsync jobs HOST1 runs before handing containers back to HOST2 after recovery.
# Uses rsync.sh with the existing profile system — basename matched to profile keys.
# Comment out jobs that are not yet ready or not needed for handback.
FAILOVER_HOST1_RSYNC_JOBS=(
# "/mnt/user/appdata-Failover/Jayred365"
# "/mnt/user/Media_Server/Emby-Jayred"
)
# ━━━ HOST2 Failover Config (unRAID-Jayred365 — Secondary) ━━━
# Containers HOST2 starts locally when HOST1 goes down.
# Emby starts on HOST2 so media keeps working during HOST1 outage.
# HOST1's DDNS containers start here so DNS updates to point at HOST2's IP.
# HOST2 (unRAID-Jayred365 — Secondary)
FAILOVER_HOST2_STARTS_FOR_HOST1=(
"Emby"
"Gmer4Lfe.com"
"Gmer4Lfe.us"
)
# Containers HOST2 stops when it loses internet connectivity.
FAILOVER_HOST2_STOP_ON_NO_NET=(
"Gmer4Lfe.com"
"Gmer4Lfe.us"
)
# Rsync jobs HOST2 runs before handing containers back to HOST1 after recovery.
FAILOVER_HOST2_RSYNC_JOBS=(
# "/mnt/user/appdata-Failover/Gmer4Lfe"
)
# ==============================================================================================
# ── DOCKER ESSENTIALS ─────────────────────────────────────────────────────────────────────────
# ==============================================================================================
@@ -702,7 +683,7 @@ MEDIA_MAINTENANCE_JOBS=(
TRANSCODE_EMBY_CONTAINER="Emby" # exact Docker container name — case sensitive
# ==============================================================================================
# ── MONITOR ───────────────────────────────────────────────────────────────────────────────────
# ── MONITORS ───────────────────────────────────────────────────────────────────────────────────
# ==============================================================================================
# Monitoring scripts — watch and report only, never take action.
# Lives in Monitor/ folder — distinct from unRAID_Essentials (which acts) and