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
+26 -13
View File
@@ -76,8 +76,9 @@
#
# It then defines the paths the rest of the ecosystem builds on:
#
# CONF_RAM_CACHE_DIR /tmp/.cache/vv/d — tmpfs partner conf cache, cleared each reboot
# ARR_CACHE_DIR /tmp/arr_cache — tmpfs, restored from DATA_DIR on demand
# VV_CACHE_ROOT everything Varaverk keeps in RAM, one root, defined in master.conf
# CONF_RAM_CACHE_DIR $VV_CACHE_ROOT/conf — partner conf cache, chmod 700, snapshotted
# ARR_CACHE_DIR $VV_CACHE_ROOT/arr — restored from DATA_DIR on demand
#
# Everything else (STATE_DIR, DATA_DIR, thresholds, credentials) comes out of master.conf and
# host*.conf, which this file sources rather than defines.
@@ -130,6 +131,23 @@
fi
source "$LOAD_CONFIG_DIR/Configurations/master.conf"
# ━━━ Cache roots ━━━
# Resolved here, immediately after master.conf, rather than with the other derived paths further
# down — the partner-conf cache is read a few lines below to source HOST2_* vars, and that block
# used to carry its own copy of the path precisely because the variable did not exist yet at that
# point. Defining these the moment master.conf provides them removes the reason for the copy.
#
# The fallbacks are the pre-consolidation paths: an installation whose conf has not been through
# conf_upgrade keeps using what it is already using rather than silently relocating its caches.
# The PHP layer reads the same keys out of the same file, with the same fallbacks.
VV_CACHE_ROOT="${VV_CACHE_ROOT:-/tmp/varaverk}"
VV_CACHE_DIR="${VV_CACHE_DIR:-/tmp/vv_cache}"
CONF_RAM_CACHE_DIR="${CONF_RAM_CACHE_DIR:-/tmp/.cache/vv/d}"
ARR_CACHE_DIR="${ARR_CACHE_DIR:-/tmp/arr_cache}"
AI_TOKEN_CACHE_DIR="${AI_TOKEN_CACHE_DIR:-/tmp/.cache/vv/ai}"
AI_JOB_DIR="${AI_JOB_DIR:-/tmp/varaverk_ai_jobs}"
DOCKER_JOB_DIR="${DOCKER_JOB_DIR:-/tmp/varaverk_dk_jobs}"
# ━━━ Auto-discover and source all host*.conf files ━━━
# Sorted for consistent load order — HOST1 before HOST2 before HOST3 etc.
# Each host conf extends the shared PROFILE_* arrays and adds host-specific vars.
@@ -160,7 +178,7 @@
# (HOST2_*, HOST3_*, …) available without committing credentials to the git repo
# or violating sparse checkout — partner confs live in RAM only, cleared on reboot.
# Confs already loaded from disk are skipped — disk copy is authoritative.
_VV_CONF_CACHE="/tmp/.cache/vv/d"
_VV_CONF_CACHE="$CONF_RAM_CACHE_DIR"
if [[ -d "$_VV_CONF_CACHE" ]]; then
while IFS= read -r _conf; do
[[ -f "$_conf" ]] || continue
@@ -195,16 +213,11 @@
# re-deriving from SCRIPTS_DIR or hardcoding /var/log or /tmp paths inline.
CONF_DIR="${SCRIPTS_DIR}/Configurations"
LOG_DIR="/var/log/varaverk"
VV_CACHE_DIR="/tmp/vv_cache"
CONF_RAM_CACHE_DIR="/tmp/.cache/vv/d" # tmpfs — cleared every reboot, repopulated by conf_sync.sh
ARR_CACHE_DIR="/tmp/arr_cache" # tmpfs — cleared every reboot, restored from DATA_DIR backup by arr_cache_age_seconds()
# Partner AI ledgers pulled by AI/ai_token_sync.sh. A sibling of the conf cache rather than
# the same directory: that one holds credentials at chmod 700 and is snapshotted to /boot by
# conf_cache_save.sh. These are non-secret counters that are worthless when stale, so they
# must not be preserved across a reboot — losing them just means "not collected here" until
# the next sync, which is the honest answer anyway.
AI_TOKEN_CACHE_DIR="/tmp/.cache/vv/ai" # tmpfs — cleared every reboot, repopulated by ai_token_sync.sh
export CONF_DIR LOG_DIR VV_CACHE_DIR CONF_RAM_CACHE_DIR ARR_CACHE_DIR AI_TOKEN_CACHE_DIR
# Cache roots were resolved right after master.conf was sourced, because the partner-conf
# cache is read before this point. Exported here with the rest.
export CONF_DIR LOG_DIR VV_CACHE_ROOT VV_CACHE_DIR CONF_RAM_CACHE_DIR ARR_CACHE_DIR \
AI_TOKEN_CACHE_DIR AI_JOB_DIR DOCKER_JOB_DIR
# ━━━ Cleanup ━━━
unset _conf _host_confs_loaded _adapter LOAD_CONFIG_DIR