Release v2.1.0: Programmatic zero-token version bumper (hs-sync-version --auto-bump) and daily 00:20 UTC VPS archive rotation cronjob (deploy/run-vps-archive-rotation.sh)
This commit is contained in:
1 parent
54e7f8ff61
commit
b9703cda5e
47 files changed
+1243
-598
No files matched your search
@@ -0,0 +1,9 @@
|
||||
# /etc/cron.d/hyperstition-archive-rotate
|
||||
# Installed by /srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh
|
||||
# Runs daily at 00:20 UTC (19:20 EST — Window C, 20 minutes after 00:00 UTC rollover harvest).
|
||||
# Rotates loose docs/archive/*.{md,pdf} pairs into completed-plans-archive.tar.gz and checks SQLite telemetry DB (100M).
|
||||
SHELL=/bin/bash
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
TZ=UTC
|
||||
|
||||
20 0 * * * root /srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/run-vps-archive-rotation.sh >> /var/log/hyperstition-archive-rotate.log 2>&1
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Hyperstition Studio Daily Cold-Archive & SQLite Telemetry Rotation (00:20 UTC)
|
||||
After=network-online.target hyperstition-utc-rollover-harvest.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=root
|
||||
WorkingDirectory=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core
|
||||
Environment="TZ=UTC"
|
||||
Environment="PYTHONPATH=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/src"
|
||||
ExecStart=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/run-vps-archive-rotation.sh
|
||||
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Daily 00:20 UTC Timer for Hyperstition Studio Cold-Archive & SQLite Rotation
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* 00:20:00 UTC
|
||||
Persistent=true
|
||||
Unit=hyperstition-archive-rotate.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
# /workspace/hyperstitionstudio-core/deploy/run-vps-archive-rotation.sh
|
||||
# Daily 00:20 UTC (19:20 EST) Cold-Archive Rotation & Quiescent SQLite Logrotate Runner for hyperstitionstud.io
|
||||
# Enforces 0 LLM tokens, 0 API keys, full stdout/stderr visibility, flock concurrency protection, and Gematria-Pipeline Immunity.
|
||||
set -euo pipefail
|
||||
|
||||
REPOS_ROOT="/srv/hyperstitionstud.io/repos"
|
||||
LIVE_REPOS="/var/www/hyperstitionstud.io/repos"
|
||||
LOCK_FILE="/tmp/hyperstition-archive-rotation.lock"
|
||||
DRY_RUN=0
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--repos-root=*)
|
||||
REPOS_ROOT="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--repos-root)
|
||||
REPOS_ROOT="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--live-repos=*)
|
||||
LIVE_REPOS="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
--live-repos)
|
||||
LIVE_REPOS="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "[ERROR] Unknown argument: $1" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
exec 9>"${LOCK_FILE}"
|
||||
if ! flock -n 9; then
|
||||
echo "[SKIP] Another hyperstition-archive-rotation run holds ${LOCK_FILE}; exiting cleanly."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export TZ="UTC"
|
||||
export PYTHONPATH="${REPOS_ROOT}/hyperstitionstudio-core/src"
|
||||
unset OPENROUTER_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY
|
||||
|
||||
echo "[1/3] Running Cold-Storage Plan Archive Rotation (hs-archive-rotate) against ${REPOS_ROOT}..."
|
||||
if [[ "${DRY_RUN}" -eq 1 ]]; then
|
||||
ROTATE_JSON="$(python3 -m hyperstitionstud_io.publishing.archive_rotator --workspace-root "${REPOS_ROOT}" --dry-run)"
|
||||
else
|
||||
ROTATE_JSON="$(python3 -m hyperstitionstud_io.publishing.archive_rotator --workspace-root "${REPOS_ROOT}")"
|
||||
fi
|
||||
echo "${ROTATE_JSON}"
|
||||
|
||||
echo "[2/3] Running Quiescent SQLite Telemetry Logrotate Check (100M threshold)..."
|
||||
if [[ "${DRY_RUN}" -eq 0 ]]; then
|
||||
python3 -m hyperstitionstud_io.db.sqlite_meta --compress-archive --truncate-quiescent --max-mb 100
|
||||
fi
|
||||
|
||||
echo "[3/3] Checking whether rotated docs/archive/ bundles require tmpfs webroot hydration..."
|
||||
ROTATED_COUNT="$(python3 -c 'import json,sys; d=json.loads(sys.argv[1]); print(int(d.get("rotated_loose_files", 0)))' "${ROTATE_JSON}")"
|
||||
if [[ "${DRY_RUN}" -eq 0 ]] && [[ "${ROTATED_COUNT}" -gt 0 ]] && [[ -d "${LIVE_REPOS}" ]]; then
|
||||
echo "[SYNC] Rotated ${ROTATED_COUNT} loose archive file(s); refreshing ${LIVE_REPOS}..."
|
||||
"${REPOS_ROOT}/hyperstitionstudio-core/deploy/sync-vps-repos.sh" \
|
||||
--repos-root="${REPOS_ROOT}" \
|
||||
--live-repos="${LIVE_REPOS}" \
|
||||
--no-pull \
|
||||
--no-caddy
|
||||
else
|
||||
echo "[OK] No loose archive files required rotation (rotated_loose_files=${ROTATED_COUNT}); tmpfs hydration skipped."
|
||||
fi
|
||||
@@ -122,18 +122,19 @@ if [[ -d "${REPOS_ROOT}/haiperdohp-jemaytreeah" ]]; then
|
||||
echo "[build] Copying haiperdohp-jemaytreeah/config.default.js -> config.js..."
|
||||
run_checked "copy haiperdohp-jemaytreeah config.js" cp "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.default.js" "${REPOS_ROOT}/haiperdohp-jemaytreeah/config.js"
|
||||
fi
|
||||
if [[ ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/db_lite.json" || ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/db.json" ]] && [[ -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/tools/generate_db_json.py" ]]; then
|
||||
if [[ ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/db_lite.json" || ! -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/db.json" || "${REPOS_ROOT}/haiperdohp-jemaytreeah/db.txt" -nt "${REPOS_ROOT}/haiperdohp-jemaytreeah/db.json" ]] && [[ -f "${REPOS_ROOT}/haiperdohp-jemaytreeah/tools/generate_db_json.py" ]]; then
|
||||
echo "[build] Generating haiperdohp-jemaytreeah/db.json and db_lite.json from db.txt..."
|
||||
(cd "${REPOS_ROOT}/haiperdohp-jemaytreeah" && run_checked "generate_db_json.py" "${PYTHON_BIN}" tools/generate_db_json.py db.txt db.json)
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[2/5] Synchronizing local workspace.toml version and running hs-doctor, version_sync --check, and 6-Gate Knowledge Graph Verification..."
|
||||
echo "[2/5] Synchronizing local workspace.toml version, rebuilding SQLite FTS5 catalog, and running hs-doctor, version_sync --check, and 6-Gate Knowledge Graph Verification..."
|
||||
if [[ -f "${REPOS_ROOT}/workspace.toml" ]] && [[ -f "${REPOS_ROOT}/hyperstitionstudio-core/workspace.example.toml" ]]; then
|
||||
# Sync schema_version in untracked parent workspace.toml with hyperstitionstud_io.__version__
|
||||
run_checked "version_sync (sync untracked workspace.toml)" "${PYTHON_BIN}" -m hyperstitionstud_io.version_sync
|
||||
fi
|
||||
run_checked "version_sync --check" "${PYTHON_BIN}" -m hyperstitionstud_io.version_sync --check
|
||||
run_checked "hs-db-build (--build)" "${PYTHON_BIN}" -m hyperstitionstud_io.db.sqlite_meta --build
|
||||
run_checked "hs-doctor" "${PYTHON_BIN}" -m hyperstitionstud_io.ci.doctor
|
||||
run_checked "build_encyclopedia_knowledge_graph.py --verify-only" "${PYTHON_BIN}" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only
|
||||
|
||||
@@ -208,6 +209,18 @@ if [[ "${DO_CADDY}" -eq 1 ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
SRC_CRON_ROTATE="${DEPLOY_DIR}/cron.d/hyperstition-archive-rotate"
|
||||
DST_CRON_ROTATE="/etc/cron.d/hyperstition-archive-rotate"
|
||||
if [[ -f "${SRC_CRON_ROTATE}" ]] && [[ -d "/etc/cron.d" ]] && { [[ -w "/etc/cron.d" ]] || [[ -n "${SUDO}" ]]; }; then
|
||||
if [[ -f "${DST_CRON_ROTATE}" ]] && cmp -s "${SRC_CRON_ROTATE}" "${DST_CRON_ROTATE}"; then
|
||||
echo "[5/5] ${DST_CRON_ROTATE} is already identical to deploy/cron.d/hyperstition-archive-rotate."
|
||||
else
|
||||
echo "[5/5] Installing 00:20 UTC archive rotation cron rule to ${DST_CRON_ROTATE}..."
|
||||
run_checked "copy hyperstition-archive-rotate cron rule" ${SUDO} cp "${SRC_CRON_ROTATE}" "${DST_CRON_ROTATE}"
|
||||
run_checked "chmod 0644 ${DST_CRON_ROTATE}" ${SUDO} chmod 0644 "${DST_CRON_ROTATE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$(type -P systemctl || true)" ]] && [[ -d "/run/systemd/system" ]]; then
|
||||
UNITS_CHANGED=0
|
||||
for unit_name in \
|
||||
@@ -216,7 +229,9 @@ if [[ "${DO_CADDY}" -eq 1 ]]; then
|
||||
"hyperstition-closing-bell-harvest.service" \
|
||||
"hyperstition-closing-bell-harvest.timer" \
|
||||
"hyperstition-utc-rollover-harvest.service" \
|
||||
"hyperstition-utc-rollover-harvest.timer"; do
|
||||
"hyperstition-utc-rollover-harvest.timer" \
|
||||
"hyperstition-archive-rotate.service" \
|
||||
"hyperstition-archive-rotate.timer"; do
|
||||
src_u="${DEPLOY_DIR}/${unit_name}"
|
||||
dst_u="/etc/systemd/system/${unit_name}"
|
||||
if [[ -f "${src_u}" ]]; then
|
||||
@@ -234,6 +249,7 @@ if [[ "${DO_CADDY}" -eq 1 ]]; then
|
||||
run_checked "systemctl restart hyperstition-mcp.service" ${SUDO} systemctl restart hyperstition-mcp.service
|
||||
run_checked "systemctl enable --now hyperstition-closing-bell-harvest.timer" ${SUDO} systemctl enable --now hyperstition-closing-bell-harvest.timer
|
||||
run_checked "systemctl enable --now hyperstition-utc-rollover-harvest.timer" ${SUDO} systemctl enable --now hyperstition-utc-rollover-harvest.timer
|
||||
run_checked "systemctl enable --now hyperstition-archive-rotate.timer" ${SUDO} systemctl enable --now hyperstition-archive-rotate.timer
|
||||
elif [[ -f "/etc/systemd/system/hyperstition-mcp.service" ]]; then
|
||||
echo "[5/5] Restarting hyperstition-mcp.service to load latest MCP & REST API v1 (/api/v1/*) modules..."
|
||||
run_checked "systemctl enable --now hyperstition-mcp.service" ${SUDO} systemctl enable --now hyperstition-mcp.service
|
||||
|
||||
@@ -75,7 +75,6 @@ ROUTES=(
|
||||
"/graph/docs/periodic-harvest-cicd-to-vps-flow-diagram.png"
|
||||
"/graph/docs/VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE.pdf"
|
||||
"/graph/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.pdf"
|
||||
"/graph/docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.pdf"
|
||||
"/graph/docs/PLAN-LEXICAL-AND-ETYMOLOGICAL-SIMPLIFICATION.pdf"
|
||||
"/graph/docs/PLAN-LLM-TOKEN-ECONOMIZER-AND-VARIANCE-ROUTING.pdf"
|
||||
"/graph/docs/PLAN-LLM-TOKEN-ECONOMIZER-DATA-FIDELITY-AND-DEGRADATION-RISK-EVALUATION.pdf"
|
||||
|
||||
Reference in new issue
Block a user