feat: add --pull-only to conf_sync, wire into intermediate orchestrator

Partner conf cache (/tmp/.vv/) was only refreshed at array start. If a partner
updated their conf mid-day, this host's RAM cache went stale until next reboot.
Intermediate orchestrator now pulls partner confs every 4 hours as step 1.

conf_sync.sh --pull-only: pulls partner confs into local cache, skips push
(push is already handled by conf_populate.sh --push-only on conf save).
This commit is contained in:
Gmer4Lfe
2026-06-05 19:44:10 -04:00
parent f9fe13bdc1
commit c441ac443a
2 changed files with 36 additions and 4 deletions
+26 -3
View File
@@ -6,9 +6,10 @@
# Schedule: 0 */4 * * * (every 4 hours) # Schedule: 0 */4 * * * (every 4 hours)
# #
# ── EXECUTION ORDER ─────────────────────────────────────────────────────────────────────────── # ── EXECUTION ORDER ───────────────────────────────────────────────────────────────────────────
# 1. arr_sync.sh — sync Lidarr/Sonarr/Radarr libraries across all nodes # 1. conf_sync.sh --pull-only — refresh partner conf cache in RAM (/tmp/.vv/)
# 2. Rsync window (optional) — INTERMEDIATE_SYNC_SHARES, if any configured # 2. arr_sync.sh — sync Lidarr/Sonarr/Radarr libraries across all nodes
# 3. INTERMEDIATE_MAINTENANCE_SCRIPTS — artwork fetch and any future 4-hour jobs # 3. Rsync window (optional) — INTERMEDIATE_SYNC_SHARES, if any configured
# 4. INTERMEDIATE_MAINTENANCE_SCRIPTS — artwork fetch and any future 4-hour jobs
# #
# ── WHY A SEPARATE ORCHESTRATOR ─────────────────────────────────────────────────────────────── # ── WHY A SEPARATE ORCHESTRATOR ───────────────────────────────────────────────────────────────
# arr libraries need to converge more frequently than once a day. If a remote node adds # arr libraries need to converge more frequently than once a day. If a remote node adds
@@ -154,6 +155,28 @@ SHARE_TIMES=()
echo "" echo ""
echo "━━━ $ICON_GEAR Intermediate Sync — $MY_ID$(date '+%Y-%m-%d %H:%M:%S') ━━━" echo "━━━ $ICON_GEAR Intermediate Sync — $MY_ID$(date '+%Y-%m-%d %H:%M:%S') ━━━"
# ==============================================================================================
# ━━━ Conf Pull ━━━
# ==============================================================================================
echo ""
echo "━━━ $ICON_GEAR Conf Pull ━━━"
CONF_SYNC_SCRIPT="$SCRIPTS_ROOT/System_Essentials/conf_sync.sh"
if [[ ! -f "$CONF_SYNC_SCRIPT" ]]; then
warn "conf_sync.sh not found — skipping partner conf refresh"
else
_conf_args=("--pull-only")
[[ "$DRY_RUN" == true ]] && _conf_args+=("--dry-run")
if bash "$CONF_SYNC_SCRIPT" "${_conf_args[@]}"; then
log "Partner conf cache refreshed ✅"
JOB_PASS+=("conf_sync.sh --pull-only")
else
warn "Partner conf pull failed — cache may be stale"
JOB_FAIL+=("conf_sync.sh --pull-only")
fi
unset _conf_args
fi
# ============================================================================================== # ==============================================================================================
# ━━━ Arr Sync ━━━ # ━━━ Arr Sync ━━━
# ============================================================================================== # ==============================================================================================
+10 -1
View File
@@ -27,6 +27,7 @@
# #
# conf_sync.sh Full sync: pull from all partners + push to all partners # conf_sync.sh Full sync: pull from all partners + push to all partners
# conf_sync.sh --push-only Push own conf to all partners (fast, for conf-save hook) # conf_sync.sh --push-only Push own conf to all partners (fast, for conf-save hook)
# conf_sync.sh --pull-only Pull partner confs into local cache only (for intermediate orch)
# conf_sync.sh --dry-run Show what would happen, no changes # conf_sync.sh --dry-run Show what would happen, no changes
# conf_sync.sh --log Verbose output # conf_sync.sh --log Verbose output
# #
@@ -36,10 +37,12 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../load_config.sh" source "$SCRIPT_DIR/../load_config.sh"
PUSH_ONLY=false PUSH_ONLY=false
PULL_ONLY=false
FILTERED_ARGS=() FILTERED_ARGS=()
for arg in "$@"; do for arg in "$@"; do
case "$arg" in case "$arg" in
--push-only) PUSH_ONLY=true ;; --push-only) PUSH_ONLY=true ;;
--pull-only) PULL_ONLY=true ;;
*) FILTERED_ARGS+=("$arg") ;; *) FILTERED_ARGS+=("$arg") ;;
esac esac
done done
@@ -58,7 +61,7 @@ if [[ "$DRY_RUN" == false ]]; then
fi fi
# ── Copy own conf into local cache ─────────────────────────────────────────── # ── Copy own conf into local cache ───────────────────────────────────────────
if [[ "$PUSH_ONLY" == false ]]; then if [[ "$PUSH_ONLY" == false ]] && [[ "$PULL_ONLY" == false ]]; then
if [[ -f "$MY_CONF" ]]; then if [[ -f "$MY_CONF" ]]; then
if [[ "$DRY_RUN" == true ]]; then if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — would copy $(basename "$MY_CONF")$CACHE_DIR/" warn "DRY RUN — would copy $(basename "$MY_CONF")$CACHE_DIR/"
@@ -108,6 +111,10 @@ for host_var in $(compgen -v | grep -E '^HOST[0-9]+$' | sort); do
fi fi
# ── Push: send own conf to partner's /tmp/.vv/ cache ──────────────────── # ── Push: send own conf to partner's /tmp/.vv/ cache ────────────────────
if [[ "$PULL_ONLY" == true ]]; then
continue
fi
if [[ "$DRY_RUN" == true ]]; then if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — would push ${MY_ID,,}.conf → $partner_host:/tmp/.vv/config/cached/.confs/" warn "DRY RUN — would push ${MY_ID,,}.conf → $partner_host:/tmp/.vv/config/cached/.confs/"
continue continue
@@ -133,6 +140,8 @@ done
# ── Summary ─────────────────────────────────────────────────────────────────── # ── Summary ───────────────────────────────────────────────────────────────────
if [[ "$PUSH_ONLY" == true ]]; then if [[ "$PUSH_ONLY" == true ]]; then
info "Conf push complete — pushed to $PUSHED host(s)${FAILED:+, $FAILED failed}" info "Conf push complete — pushed to $PUSHED host(s)${FAILED:+, $FAILED failed}"
elif [[ "$PULL_ONLY" == true ]]; then
info "Conf pull complete — pulled $PULLED partner conf(s)${FAILED:+, $FAILED failed}"
else else
info "Conf sync complete — pulled $PULLED, pushed $PUSHED${FAILED:+, $FAILED failed}" info "Conf sync complete — pulled $PULLED, pushed $PUSHED${FAILED:+, $FAILED failed}"
fi fi