From fd2f671b9f25725b53b7dd32a0d8cbbdc25af586 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sun, 29 Nov 2026 23:21:14 +0000 Subject: [PATCH] feat(deploy): bundle sync-vps-repos.sh, Caddyfile, systemd unit, and 22-route test-first-deployment.sh harness (v1.2.0) --- README.md | 3 + deploy/Caddyfile | 88 +++++++++++++++++++++ deploy/hyperstition-tmpfs-sync.service | 14 ++++ deploy/sync-vps-repos.sh | 104 +++++++++++++++++++++++++ deploy/test-first-deployment.sh | 77 ++++++++++++++++++ site/index.html | 20 ++--- 6 files changed, 297 insertions(+), 9 deletions(-) create mode 100644 deploy/Caddyfile create mode 100644 deploy/hyperstition-tmpfs-sync.service create mode 100755 deploy/sync-vps-repos.sh create mode 100755 deploy/test-first-deployment.sh diff --git a/README.md b/README.md index 8bed064..bf34562 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,9 @@ hs-doctor # 5. Run the 6-suite verification test runner (stdlib-compatible, zero pytest dependency required) python3 hyperstitionstudio-core/tests/test_core_suite.py + +# 6. Test the complete per-repository web deployment locally across all 22 HTTP routes +./hyperstitionstudio-core/deploy/test-first-deployment.sh ``` --- diff --git a/deploy/Caddyfile b/deploy/Caddyfile new file mode 100644 index 0000000..ee6ca5a --- /dev/null +++ b/deploy/Caddyfile @@ -0,0 +1,88 @@ +# /etc/caddy/Caddyfile — Direct Per-Repository Install Directory Routing (HTTP/3 + Precompressed Brotli-11) +{ + servers { + protocols h1 h2 h3 + } +} + +www.hyperstitionstud.io { + redir https://hyperstitionstud.io{uri} permanent +} + +hyperstitionstud.io { + encode zstd gzip + + header { + Alt-Svc "h3=\":443\"; ma=2592000" + Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" + X-Content-Type-Options "nosniff" + Referrer-Policy "strict-origin-when-cross-origin" + -Server + } + + @immutable_media path *.pdf *.png *.mp3 *.graphml *.gexf *.canvas + header @immutable_media Cache-Control "public, max-age=86400, stale-while-revalidate=604800" + + @html_js path *.html *.js *.json + header @html_js Cache-Control "public, max-age=300, stale-while-revalidate=86400" + + # 1. Repo Install Dir: encyclopedia-knowledge-graph -> https://hyperstitionstud.io/graph/* + handle_path /graph/* { + root * /var/www/hyperstitionstud.io/repos/encyclopedia-knowledge-graph + file_server { + precompressed br gzip + } + } + redir /graph /graph/ permanent + + # 2. Repo Install Dir: technocapital-singularity-zoology -> /encyclopedia/*, /zoology/* & sibling PDF target + handle_path /encyclopedia/* { + root * /var/www/hyperstitionstud.io/repos/technocapital-singularity-zoology/encyclopedia + file_server { + precompressed br gzip + } + } + handle_path /technocapital-singularity-zoology/* { + root * /var/www/hyperstitionstud.io/repos/technocapital-singularity-zoology + file_server { + precompressed br gzip + } + } + handle_path /zoology/* { + root * /var/www/hyperstitionstud.io/repos/technocapital-singularity-zoology + file_server { + precompressed br gzip + } + } + + # 3. Repo Install Dir: ingglish-hyperdope-gematria -> /archive/* + handle_path /archive/* { + root * /var/www/hyperstitionstud.io/repos/ingglish-hyperdope-gematria/ingglish-aq-archive + file_server { + precompressed br gzip + } + } + + # 4. Repo Install Dir: ingglish-hyperdope-ci -> /ci/* + handle_path /ci/* { + root * /var/www/hyperstitionstud.io/repos/ingglish-hyperdope-ci + file_server { + precompressed br gzip + } + } + redir /ci /ci/ permanent + + # 5. Repo Install Dir: hyperstitionstudio-core -> /schemas/* and Root Portal Homepage (/) + handle_path /schemas/* { + root * /var/www/hyperstitionstud.io/repos/hyperstitionstudio-core/schemas + file_server { + precompressed br gzip + } + } + handle { + root * /var/www/hyperstitionstud.io/repos/hyperstitionstudio-core/site + file_server { + precompressed br gzip + } + } +} diff --git a/deploy/hyperstition-tmpfs-sync.service b/deploy/hyperstition-tmpfs-sync.service new file mode 100644 index 0000000..cdec7e7 --- /dev/null +++ b/deploy/hyperstition-tmpfs-sync.service @@ -0,0 +1,14 @@ +# /etc/systemd/system/hyperstition-tmpfs-sync.service +[Unit] +Description=Hydrate RAM-backed /var/www/hyperstitionstud.io/repos from NVMe repo install dirs +After=local-fs.target +RequiresMountsFor=/var/www/hyperstitionstud.io/repos +Before=caddy.service + +[Service] +Type=oneshot +ExecStart=/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh --no-pull +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/deploy/sync-vps-repos.sh b/deploy/sync-vps-repos.sh new file mode 100755 index 0000000..17a9ec4 --- /dev/null +++ b/deploy/sync-vps-repos.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +# /workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh +# Hydrates per-repository install directories from REPOS_ROOT into LIVE_REPOS (tmpfs RAM mount), +# builds calc/db.json if absent, creates top-level route symlinks, and pre-compresses (.br / .gz). +# +# Usage: +# ./sync-vps-repos.sh all # Pull from git.libre.audio, audit & sync all 5 repos +# ./sync-vps-repos.sh encyclopedia-knowledge-graph # Pull, audit & sync a single repo +# ./sync-vps-repos.sh --no-pull # Audit & sync existing local clones without network fetch +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" +DEFAULT_REPOS_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" + +export REPOS_ROOT="${REPOS_ROOT:-${DEFAULT_REPOS_ROOT}}" +export LIVE_REPOS="${LIVE_REPOS:-/var/www/hyperstitionstud.io/repos}" +TARGET_REPO="${1:-all}" + +# Use sudo only when writing to a root-owned target directory as a non-root user +SUDO="" +if [[ "${EUID:-$(id -u)}" -ne 0 ]] && [[ ! -w "$(dirname "${LIVE_REPOS}")" ]] && command -v sudo >/dev/null 2>&1; then + SUDO="sudo" +fi + +PYTHON_BIN="python3" +if [[ -x "${REPOS_ROOT}/.venv/bin/python3" ]]; then + PYTHON_BIN="${REPOS_ROOT}/.venv/bin/python3" +fi +export PYTHONPATH="${REPOS_ROOT}/hyperstitionstudio-core/src${PYTHONPATH:+:${PYTHONPATH}}" +if [[ -f "${REPOS_ROOT}/workspace.toml" ]]; then + export HYPERSTITIONSTUDIO_CONFIG="${REPOS_ROOT}/workspace.toml" +fi + +# Detect whether the 5th repository is cloned as ingglish-hyperdope-ci or hyperdope-ci-build +CI_REPO_DIR="ingglish-hyperdope-ci" +if [[ ! -d "${REPOS_ROOT}/${CI_REPO_DIR}" ]] && [[ -d "${REPOS_ROOT}/hyperdope-ci-build" ]]; then + CI_REPO_DIR="hyperdope-ci-build" +fi + +REPOS=( + "hyperstitionstudio-core:main" + "ingglish-hyperdope-gematria:main" + "technocapital-singularity-zoology:main" + "encyclopedia-knowledge-graph:main" + "${CI_REPO_DIR}:feat/ingglish-aq-corpus" +) + +if [[ "${TARGET_REPO}" != "--no-pull" ]]; then + for entry in "${REPOS[@]}"; do + repo="${entry%%:*}" + branch="${entry##*:}" + if [[ "${TARGET_REPO}" != "all" && "${TARGET_REPO}" != "${repo}" ]]; then + continue + fi + if [[ -d "${REPOS_ROOT}/${repo}/.git" ]]; then + echo "[1/4] Updating ${REPOS_ROOT}/${repo} (${branch})..." + git -C "${REPOS_ROOT}/${repo}" fetch origin "${branch}" --tags + git -C "${REPOS_ROOT}/${repo}" merge --ff-only "origin/${branch}" + fi + done +fi + +echo "[2/4] Running hs-doctor and 6-Gate Knowledge Graph Verification..." +"${PYTHON_BIN}" -m hyperstitionstud_io.ci.doctor >/dev/null +"${PYTHON_BIN}" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only >/dev/null + +echo "[3/4] Syncing per-repository install directories into ${LIVE_REPOS}..." +${SUDO} mkdir -p "${LIVE_REPOS}" +for entry in "${REPOS[@]}"; do + repo="${entry%%:*}" + if [[ "${TARGET_REPO}" != "all" && "${TARGET_REPO}" != "--no-pull" && "${TARGET_REPO}" != "${repo}" ]]; then + continue + fi + if [[ -d "${REPOS_ROOT}/${repo}" ]]; then + ${SUDO} mkdir -p "${LIVE_REPOS}/${repo}" + ${SUDO} rsync -a --delete --exclude='.git' "${REPOS_ROOT}/${repo}/" "${LIVE_REPOS}/${repo}/" + fi +done + +# Ensure canonical ingglish-hyperdope-ci directory name exists in LIVE_REPOS if sourced from hyperdope-ci-build +if [[ "${CI_REPO_DIR}" == "hyperdope-ci-build" ]] && [[ -d "${LIVE_REPOS}/hyperdope-ci-build" ]] && [[ ! -e "${LIVE_REPOS}/ingglish-hyperdope-ci" ]]; then + ${SUDO} ln -sfn "hyperdope-ci-build" "${LIVE_REPOS}/ingglish-hyperdope-ci" +fi + +# Create relative route symlinks inside LIVE_REPOS so both Caddy and standalone HTTP servers resolve all routes +${SUDO} ln -sfn "hyperstitionstudio-core/site/index.html" "${LIVE_REPOS}/index.html" +${SUDO} ln -sfn "encyclopedia-knowledge-graph" "${LIVE_REPOS}/graph" +${SUDO} ln -sfn "technocapital-singularity-zoology/encyclopedia" "${LIVE_REPOS}/encyclopedia" +${SUDO} ln -sfn "technocapital-singularity-zoology" "${LIVE_REPOS}/zoology" +${SUDO} ln -sfn "ingglish-hyperdope-gematria/ingglish-aq-archive" "${LIVE_REPOS}/archive" +${SUDO} ln -sfn "ingglish-hyperdope-ci" "${LIVE_REPOS}/ci" +${SUDO} ln -sfn "hyperstitionstudio-core/schemas" "${LIVE_REPOS}/schemas" + +echo "[4/4] Pre-compressing HTML, JS, JSON, XML, Canvas, MD & CSS assets (.br / .gz)..." +${SUDO} find "${LIVE_REPOS}" -type f \ + \( -name "*.html" -o -name "*.js" -o -name "*.json" -o -name "*.graphml" -o -name "*.gexf" -o -name "*.canvas" -o -name "*.css" -o -name "*.md" \) \ + -exec gzip -9 -k -f {} \; +if command -v brotli >/dev/null 2>&1; then + ${SUDO} find "${LIVE_REPOS}" -type f \ + \( -name "*.html" -o -name "*.js" -o -name "*.json" -o -name "*.graphml" -o -name "*.gexf" -o -name "*.canvas" -o -name "*.css" -o -name "*.md" \) \ + -exec brotli -q 11 -k -f {} \; +fi + +echo "[OK] Per-repository install directories hydrated and pre-compressed at ${LIVE_REPOS}" diff --git a/deploy/test-first-deployment.sh b/deploy/test-first-deployment.sh new file mode 100755 index 0000000..57398c5 --- /dev/null +++ b/deploy/test-first-deployment.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# /workspace/hyperstitionstudio-core/deploy/test-first-deployment.sh +# End-to-end verification of the per-repository deployment layout. +# +# Mode 1 (Default — Local / Staging Self-Contained HTTP Smoke Test): +# Hydrates LIVE_REPOS (default: /tmp/hyperstition-live-repos), starts a local HTTP server +# on 127.0.0.1:18090, and verifies HTTP 200 OK across all 19 portal & deep-link routes. +# +# Mode 2 (Remote VPS Verification): +# ./test-first-deployment.sh https://hyperstitionstud.io +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" +TARGET_BASE_URL="${1:-}" +SERVER_PID="" + +cleanup() { + if [[ -n "${SERVER_PID}" ]] && kill -0 "${SERVER_PID}" 2>/dev/null; then + kill "${SERVER_PID}" 2>/dev/null || true + fi +} +trap cleanup EXIT + +if [[ -z "${TARGET_BASE_URL}" ]]; then + export LIVE_REPOS="${LIVE_REPOS:-/tmp/hyperstition-live-repos}" + rm -rf "${LIVE_REPOS}" + echo "[1/3] Hydrating per-repository webroot at ${LIVE_REPOS} via sync-vps-repos.sh --no-pull..." + "${SCRIPT_DIR}/sync-vps-repos.sh" --no-pull + + PORT="${TEST_PORT:-18090}" + echo "[2/3] Starting local HTTP server on http://127.0.0.1:${PORT} serving ${LIVE_REPOS}..." + python3 -m http.server "${PORT}" --bind 127.0.0.1 --directory "${LIVE_REPOS}" >/dev/null 2>&1 & + SERVER_PID="$!" + sleep 0.6 + TARGET_BASE_URL="http://127.0.0.1:${PORT}" +fi + +echo "[3/3] Verifying all 19 portal homepage, graph, encyclopedia, sibling-PDF, calculator & schema routes against ${TARGET_BASE_URL}..." +ROUTES=( + "/" + "/graph/index.html" + "/graph/graph-data.js" + "/graph/encyclopedia-graph.json" + "/graph/OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.pdf" + "/graph/docs/specification-concentric-eti-tier-ring-radar-d-periphery.pdf" + "/graph/docs/cross-repo-dependency-and-audit-flow-diagram.html" + "/graph/docs/cross-repo-dependency-and-audit-flow-diagram.pdf" + "/graph/docs/VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE.pdf" + "/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf" + "/technocapital-singularity-zoology/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf" + "/zoology/encyclopedia-of-technocapital-singularity-zoology-overview-and-manifest.pdf" + "/zoology/technocapital-singularity-zoology-comprehensive-glossary.pdf" + "/zoology/tier-list-technocapital-assemblage-builds.png" + "/zoology/tier-list-technocapital-assemblage-builds.pdf" + "/zoology/proposal-fund-manager-novel-investment-discovery.pdf" + "/zoology/proposal-corporate-board-technocapital-allocation.pdf" + "/zoology/m7-emergent-subclass-bidirectional-aq-nucleation.pdf" + "/archive/00-index-and-methodology.md" + "/ci/ONBOARDING-INGGLISH-AQ.pdf" + "/ci/ci-audit-report.json" + "/schemas/v1/encyclopedia-graph.schema.json" +) + +PASS_COUNT=0 +for route in "${ROUTES[@]}"; do + url="${TARGET_BASE_URL}${route}" + code="$(curl -s -o /dev/null -w "%{http_code}" "${url}")" + if [[ "${code}" == "200" ]]; then + PASS_COUNT=$((PASS_COUNT + 1)) + echo " [200 OK] ${route}" + else + echo " [FAIL ${code}] ${url}" >&2 + exit 1 + fi +done + +echo "[OK] All ${PASS_COUNT}/${#ROUTES[@]} deployment routes verified (HTTP 200 OK)." diff --git a/site/index.html b/site/index.html index 0db1206..63826e7 100644 --- a/site/index.html +++ b/site/index.html @@ -214,19 +214,20 @@ - +
05 // Bidirectional Base-36 AQ & CMUdict Corpus -

Ingglish Hyperdope-Gematria Archive & Calculator

-

70 verified cross-scale (333 / 666 / 777) dossiers with 0.0% generic padding, 4,897 offline CMUdict phonemic mappings, and the browser-based multi-cipher AQ calculator workbench.

+

Ingglish Hyperdope-Gematria Archive & 4-Gate CI

+

70 verified cross-scale (333 / 666 / 777) dossiers with 0.0% generic padding, 4,897 offline CMUdict phonemic mappings, and the 4-Gate CI provisioning corpus (100.0% keep rate).

Dossiers 01–70 100.0% 4-Gate CI Keep Rate
@@ -271,11 +272,12 @@ "tier-pdf": "../../technocapital-singularity-zoology/tier-list-technocapital-assemblage-builds.pdf", "radar-spec": "../../encyclopedia-knowledge-graph/docs/specification-concentric-eti-tier-ring-radar-d-periphery.pdf", "prop-fund": "../../technocapital-singularity-zoology/proposal-fund-manager-novel-investment-discovery.pdf", - "prop-board": "../../technocapital-singularity-zoology/proposal-corporate-board-technocapital-allocation.pdf", - "m7-pdf": "../../technocapital-singularity-zoology/m7-emergent-subclass-bidirectional-aq-nucleation.pdf", - "calc-app": "../../hyperdope-ci-build/index.html", - "arch-index": "../../ingglish-hyperdope-gematria/ingglish-aq-archive/00-index-and-methodology.md", - "schemas-v1": "../schemas/v1/encyclopedia-graph.schema.json", + "prop-board": "../../technocapital-singularity-zoology/proposal-corporate-board-technocapital-allocation.pdf", + "m7-pdf": "../../technocapital-singularity-zoology/m7-emergent-subclass-bidirectional-aq-nucleation.pdf", + "ci-onboarding": "../../hyperdope-ci-build/ONBOARDING-INGGLISH-AQ.pdf", + "ci-audit": "../../hyperdope-ci-build/ci-audit-report.json", + "arch-index": "../../ingglish-hyperdope-gematria/ingglish-aq-archive/00-index-and-methodology.md", + "schemas-v1": "../schemas/v1/encyclopedia-graph.schema.json", "dep-html": "../../encyclopedia-knowledge-graph/docs/cross-repo-dependency-and-audit-flow-diagram.html", "dep-pdf": "../../encyclopedia-knowledge-graph/docs/cross-repo-dependency-and-audit-flow-diagram.pdf", "vps-guide": "../../encyclopedia-knowledge-graph/docs/VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE.pdf"