Put every tmpfs path in one place both layers can read

This commit is contained in:
Gmer4Lfe
2026-08-08 22:57:29 -04:00
parent 0f92609425
commit d5c36db531
7 changed files with 119 additions and 23 deletions
+38
View File
@@ -122,6 +122,44 @@
STATE_DIR="/boot/config/plugins/varaverk/State_Files"
PERSISTENT_CONF_CACHE="/boot/config/plugins/varaverk/.cache/vv/d"
# ── Cache Roots ──
# Everything Varaverk keeps in RAM, under one root, defined once.
#
# These used to be four literals in load_config.sh and three more in the PHP layer, spread over
# /tmp/vv_cache, /tmp/arr_cache, /tmp/.cache/vv/d, /tmp/.cache/vv/ai and /tmp/varaverk_ai_jobs —
# five naming schemes, and no single place that could tell you what Varaverk had in tmpfs. PHP
# could not read load_config.sh, so it restated the paths it needed and the two layers were kept
# in agreement by hand. They live here because master.conf is the one file both layers actually
# read: bash sources it, and the PHP conf parser resolves ${VAR} against it the same way.
#
# ONE ROOT, NOT ONE DIRECTORY. The subdirectories are deliberately separate and must stay that
# way — they have genuinely different rules:
#
# conf/ holds partner credentials, is chmod 700, and IS snapshotted to PERSISTENT_CONF_CACHE
# so it survives a reboot.
# ai/ holds non-secret token counters that are worthless when stale and must NOT be
# preserved across a reboot — losing them means "not collected here" until the next
# sync, which is the honest answer.
# jobs/ holds in-flight work handed off to a detached worker — an AI answer being generated,
# a container action being applied. chmod 700: each is readable by anyone who can guess
# its token, which is why the tokens are random_bytes and not sequential.
# arr/ is the large one (100s of MB) and is restored from a DATA_DIR backup on demand.
# api/ is the WebGUI payload cache, and is the only one safe to delete at any moment.
#
# Collapsing those into a single directory would give the credentials the token cache's
# persistence rules, or the reverse. The win here is one definition, not one folder.
#
# Point VV_CACHE_ROOT somewhere else and everything follows. It must be on a filesystem that is
# cleared or safe to clear on boot — every consumer treats a missing cache as a cold start, and
# nothing here is a source of truth for anything.
VV_CACHE_ROOT="/tmp/varaverk"
VV_CACHE_DIR="${VV_CACHE_ROOT}/api" # WebGUI payload cache — monitor, arrs, ai
CONF_RAM_CACHE_DIR="${VV_CACHE_ROOT}/conf" # partner host*.conf — chmod 700, snapshotted
ARR_CACHE_DIR="${VV_CACHE_ROOT}/arr" # arr payloads — restored from DATA_DIR on demand
AI_TOKEN_CACHE_DIR="${VV_CACHE_ROOT}/ai" # partner token ledgers — never preserved
AI_JOB_DIR="${VV_CACHE_ROOT}/jobs/ai" # in-flight AI answers — chmod 700
DOCKER_JOB_DIR="${VV_CACHE_ROOT}/jobs/docker" # in-flight container actions — chmod 700
# ── Version Parity ──
# Controls behaviour when local and remote unRAID versions differ.
# Major version mismatch always aborts regardless of this setting.