docs(vps): update VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE to v2.1.0 with sequential 7-step runbook and bundled test-first-deployment.sh harness (v1.0.0)

This commit is contained in:
Hermes Agent committed 2026-11-29 23:21:14 +00:00
1 parent ec382894a5
commit b8b960e605
4 files changed
+290 -854

No files matched your search

@@ -1,104 +1,75 @@
# Production Deployment Plan (`v2.0.0`): Lightning-Fast `hyperstitionstud.io` Homepage & Knowledge Workbench on a Linode / Akamai VPS Using Direct Per-Repository Install Directory Mapping
# Production VPS & Git Operator Deployment Guide (`v2.1.0` — Direct Per-Repository Install Directory Edition)
- **Document ID:** `PLAN-LINODE-AKAMAI-VPS-HOMEPAGE-DEPLOYMENT` (`v2.0.0` — Direct Per-Repository Install Directory Edition)
- **Document ID:** `VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE` (`v2.1.0`)
- **Target Domain:** `https://hyperstitionstud.io` (and `https://www.hyperstitionstud.io` -> `308` redirect)
- **Upstream Git Forge:** `git.libre.audio` (`https://git.libre.audio/seasharp/<repo-slug>.git`)
- **Target Infrastructure:** Linode / Akamai Connected Cloud VPS (Debian 12 Bookworm or Ubuntu 24.04 LTS on AMD EPYC, IPv4 + IPv6 dual-stack, Cloud Firewall + DNS `HTTPS` `h3` record)
- **Core Architectural Upgrade in `v2.0.0`:**
- **Direct 1-to-1 Repository-to-Install-Directory Mapping:** Each `git.libre.audio` repository is cloned into its own permanent install directory `/srv/hyperstitionstud.io/repos/<repo-slug>` on NVMe and mirrored 1-to-1 into the RAM-backed `tmpfs` mount `/var/www/hyperstitionstud.io/repos/<repo-slug>`.
- **Zero Cross-Repo File Copying & Zero `graph-data.js` Rewriting:** Caddy's `handle_path` blocks route `/`, `/graph/*`, `/encyclopedia/*`, `/technocapital-singularity-zoology/*`, `/zoology/*`, `/archive/*`, `/calc/*`, and `/schemas/*` directly into the corresponding repository install directory in RAM.
- **Performance Targets:**
- **Time to First Byte (`TTFB`):** `< 15 ms` (regional) / `< 40 ms` (global)
- **Largest Contentful Paint (`LCP`):** `< 200 ms`
- **Portal Homepage Payload (`site/index.html.br`):** `~3.1 KB` over the wire
- **Knowledge Graph Payload (`graph-data.js.br`):** `~32 KB` over the wire via Pre-Compressed Brotli-11 (`-q 11`) + HTTP/3 (`QUIC`)
- **Disk I/O on Request Path:** `0 IOPS` (100% served from RAM via `tmpfs` + Linux kernel `sendfile` + `ktls`)
- **Bundled Deployment Automation (`hyperstitionstudio-core/deploy/`):**
- `deploy/sync-vps-repos.sh` — Pulls from `git.libre.audio`, compiles `calc/db.json` if absent, runs `hs-doctor` and 6-gate Knowledge Graph verification, syncs per-repo install directories into RAM (`/var/www/hyperstitionstud.io/repos`), creates relative route symlinks, and pre-compresses `.br` (Brotli-11) and `.gz` (Gzip-9) sidecars.
- `deploy/Caddyfile` — Production Caddy 2 configuration (`HTTP/3 QUIC` + `precompressed br gzip` + direct per-repo `handle_path` routing).
- `deploy/hyperstition-tmpfs-sync.service` — `systemd` unit that hydrates `/var/www/hyperstitionstud.io/repos` on VPS boot before Caddy starts.
- `deploy/test-first-deployment.sh` — Automated 22-route HTTP verification harness (works both locally before VPS provisioning and against live `https://hyperstitionstud.io`).
---
## 1. Architectural Overview: 1-to-1 Per-Repository Install Directories in RAM (`tmpfs`)
## 1. Master 1-to-1 Mapping: `git.libre.audio` Repository -> VPS Install Dir -> Web Route
Instead of a monolithic build script that copies selected files out of multiple repositories into a synthetic folder layout (and rewrites paths inside `graph-data.js`), `v2.0.0` preserves the exact 5-repository sibling topology from `git.libre.audio` directly on the Linode VPS:
Each sibling repository on `git.libre.audio` is cloned into `/srv/hyperstitionstud.io/repos/<repo-slug>` on NVMe and synced 1-to-1 into the `256 MB` RAM-backed `tmpfs` mount at `/var/www/hyperstitionstud.io/repos/<repo-slug>`:
```text
NVMe Persistent Clones (/srv/hyperstitionstud.io/repos/)
│ (Updated independently per repo via `git fetch && git merge --ff-only`,
│ audited by `hs-doctor` + `--verify-only`, then synced via `rsync --delete` + Brotli-11)
▼
RAM-Backed tmpfs Mount (/var/www/hyperstitionstud.io/repos/ — 256 MB RAM, 0 Disk IOPS)
├── hyperstitionstudio-core/ <── git.libre.audio/seasharp/hyperstitionstudio-core.git (v1.2.0)
│ ├── site/index.html (+ .br / .gz) ──► Served at: https://hyperstitionstud.io/
│ └── schemas/v1/*.schema.json (+ .br) ──► Served at: https://hyperstitionstud.io/schemas/v1/*
├── encyclopedia-knowledge-graph/ <── git.libre.audio/seasharp/encyclopedia-knowledge-graph.git (v1.0.0)
│ ├── index.html (+ .br / .gz) ──► Served at: https://hyperstitionstud.io/graph/index.html
│ ├── graph-data.js (+ .br / .gz) ──► Served at: https://hyperstitionstud.io/graph/graph-data.js (~32 KB .br)
│ ├── encyclopedia-graph.{json,graphml,gexf} + encyclopedia.canvas (+ .br / .gz)
│ ├── atlas-mode{1,2,3}.png
│ ├── OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.pdf
│ └── docs/{VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE.pdf,cross-repo-dependency-and-audit-flow-diagram.*}
├── technocapital-singularity-zoology/ <── git.libre.audio/seasharp/technocapital-singularity-zoology.git (v1.7.0)
│ ├── encyclopedia/00..08/*.pdf ──► Served at: https://hyperstitionstud.io/encyclopedia/*
│ │ AND at: https://hyperstitionstud.io/technocapital-singularity-zoology/encyclopedia/*
│ ├── tier-list-technocapital-assemblage-builds.{pdf,png} ──► Served at: https://hyperstitionstud.io/zoology/*
│ ├── technocapital-singularity-zoology-comprehensive-glossary.pdf
│ ├── proposal-*.pdf & m7-emergent-subclass-bidirectional-aq-nucleation.pdf
│ └── dossiers/65..69-dossier-*.md
├── ingglish-hyperdope-gematria/ <── git.libre.audio/seasharp/ingglish-hyperdope-gematria.git (main)
│ └── ingglish-aq-archive/*.md ──► Served at: https://hyperstitionstud.io/archive/*
└── ingglish-hyperdope-ci/ <── git.libre.audio/seasharp/ingglish-hyperdope-ci.git (feat/ingglish-aq-corpus)
├── index.html (+ .br / .gz) ──► Served at: https://hyperstitionstud.io/calc/index.html
├── calc/*.js (+ .br / .gz)
└── db.json (+ .br / .gz)
| # | Repository Slug (`seasharp/<repo>`) | Public HTTPS Clone URL (`git.libre.audio`) | Persistent VPS Clone (`/srv/hyperstitionstud.io/repos/*`) | Direct Web Route(s) on `https://hyperstitionstud.io` |
| :- | :--- | :--- | :--- | :--- |
| **1** | `hyperstitionstudio-core` (`v1.2.0`) | `https://git.libre.audio/seasharp/hyperstitionstudio-core.git` | `/srv/hyperstitionstud.io/repos/hyperstitionstudio-core` | • `/` (`site/index.html` Portal Homepage)<br/>• `/schemas/*` (`schemas/v1/*.schema.json`) |
| **2** | `ingglish-hyperdope-gematria` (`main`) | `https://git.libre.audio/seasharp/ingglish-hyperdope-gematria.git` | `/srv/hyperstitionstud.io/repos/ingglish-hyperdope-gematria` | • `/archive/*` (`ingglish-aq-archive/`) |
| **3** | `technocapital-singularity-zoology` (`v1.7.0`) | `https://git.libre.audio/seasharp/technocapital-singularity-zoology.git` | `/srv/hyperstitionstud.io/repos/technocapital-singularity-zoology` | • `/encyclopedia/*` (`encyclopedia/`)<br/>• `/technocapital-singularity-zoology/*` (sibling PDF link target)<br/>• `/zoology/*` (root reports, tier list, glossary, `dossiers/`) |
| **4** | `encyclopedia-knowledge-graph` (`v1.0.0`) | `https://git.libre.audio/seasharp/encyclopedia-knowledge-graph.git` | `/srv/hyperstitionstud.io/repos/encyclopedia-knowledge-graph` | • `/graph/*` (`index.html`, `graph-data.js`, `atlas-mode*.png`, `.json`, `.graphml`, `.gexf`, `.canvas`, `docs/`) |
| **5** | `ingglish-hyperdope-ci` (`feat/ingglish-aq-corpus`) | `https://git.libre.audio/seasharp/ingglish-hyperdope-ci.git` | `/srv/hyperstitionstud.io/repos/ingglish-hyperdope-ci` | • `/ci/*` (`ONBOARDING-INGGLISH-AQ.pdf`, `ci-audit-report.json`, `db.txt`, `db_ingglish_entries.txt`) |
---
## 2. Testing the First Deployment Locally (Zero VPS / Zero Root Required)
Before touching a production VPS, any operator or new user can test the complete deployment hydration, route mapping, and all 22 portal & deep-link routes locally in **one command**:
```bash
# Hydrates /tmp/hyperstition-live-repos, starts a local HTTP server on 127.0.0.1:18090,
# and verifies HTTP 200 OK across all 22 routes:
./hyperstitionstudio-core/deploy/test-first-deployment.sh
```
### Why This Per-Repository Install Architecture Is Faster & Simpler to Maintain
1. **Zero File Rewriting Needed for Encyclopedia PDF Deep-Links:**
In `encyclopedia-knowledge-graph/index.html`, clicking `"Open Encyclopedia Volume PDF"` follows the relative path `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf`.
From `https://hyperstitionstud.io/graph/index.html`, the browser resolves `../technocapital-singularity-zoology/encyclopedia/...` to `https://hyperstitionstud.io/technocapital-singularity-zoology/encyclopedia/...`.
Because Caddy mounts `/technocapital-singularity-zoology/*` directly to `/var/www/hyperstitionstud.io/repos/technocapital-singularity-zoology`, the exact same unmodified `index.html` and `graph-data.js` work offline via `file://`, via local `python3 -m http.server`, and in production on `https://hyperstitionstud.io/graph/`!
2. **Independent Single-Repository Updates in `< 1.5 Seconds`:**
Pushing a commit to `encyclopedia-knowledge-graph` on `git.libre.audio` and running `./sync-vps-repos.sh encyclopedia-knowledge-graph` on the VPS updates only `/var/www/hyperstitionstud.io/repos/encyclopedia-knowledge-graph` without touching the other 4 repositories.
3. **Version-Controlled Portal Homepage (`hyperstitionstudio-core/site/index.html`):**
The root landing page (`https://hyperstitionstud.io/`) is served directly from `/var/www/hyperstitionstud.io/repos/hyperstitionstudio-core/site/index.html` (`commit e1d4f05`, `tag: v1.2.0`), featuring 6 instant-launch bento cards, `<link rel="prefetch" href="/graph/graph-data.js" as="script">`, and zero external font or CDN requests.
To keep the hydrated local deployment running on `http://127.0.0.1:8090` for interactive browser inspection:
```bash
LIVE_REPOS=/tmp/hyperstition-live-repos ./hyperstitionstudio-core/deploy/sync-vps-repos.sh --no-pull
python3 -m http.server 8090 --bind 127.0.0.1 --directory /tmp/hyperstition-live-repos
# Open in browser: http://127.0.0.1:8090/
```
---
## 2. Linode / Akamai VPS Provisioning, Firewall, DNS & Kernel Tuning
## 3. Production Linode / Akamai VPS First Deployment (Sequential Steps 1–7)
### 2.1 Instance, `tmpfs` RAM Mount & Cloud Firewall
Follow Steps 1 through 7 in order on a fresh **Debian 12 (Bookworm)** or **Ubuntu 24.04 LTS** Linode VPS (`2 GB` or `4 GB` RAM plan):
1. **Instance:** Linode Dedicated 4 GB or Shared 2 GB / 4 GB (`2 vCPU`, `4 GB RAM`, `80 GB NVMe`) running **Debian 12 (Bookworm)** or **Ubuntu 24.04 LTS** in `us-iad` (Washington, DC) or `us-east` (Newark).
2. **`/etc/fstab` RAM-Backed `tmpfs` Mount (`256 MB`):**
```fstab
tmpfs /var/www/hyperstitionstud.io/repos tmpfs defaults,size=256M,mode=0755 0 0
```
Mount immediately with:
```bash
sudo mkdir -p /var/www/hyperstitionstud.io/repos
sudo mount -a
```
3. **Linode Cloud Firewall Inbound Rules:**
- Allow `TCP 443` (HTTPS / HTTP/2)
- Allow `UDP 443` (**HTTP/3 QUIC** — mandatory for QUIC over UDP!)
- Allow `TCP 80` (ACME HTTP-01 challenge + `308` redirect to HTTPS)
- Allow `TCP 22` (SSH, restricted to operator IP / WireGuard subnet)
- Drop all other inbound traffic at the Akamai hypervisor edge.
### Step 1: Push Latest Verified Commits to `git.libre.audio` (On Workstation)
### 2.2 Linode DNS Manager Records (`hyperstitionstud.io`)
```bash
./push-all-to-git-libre-audio.sh
```
| Type | Name | Value / Target | Purpose |
| :--- | :--- | :--- | :--- |
| `A` | `@` | `<LINODE_IPV4>` | Apex IPv4 (`hyperstitionstud.io`) |
| `AAAA` | `@` | `<LINODE_IPV6>` | Apex IPv6 (`hyperstitionstud.io`) |
| `A` | `www` | `<LINODE_IPV4>` | `www` IPv4 (`308` redirect to apex) |
| `AAAA` | `www` | `<LINODE_IPV6>` | `www` IPv6 (`308` redirect to apex) |
| `CAA` | `@` | `0 issue "letsencrypt.org"` | Authorizes automatic Let's Encrypt TLS 1.3 certificates |
| `HTTPS` | `@` | `1 . alpn="h3,h2"` | **RFC 9460 SVCB/HTTPS record:** Browser negotiates **HTTP/3 (`h3`)** on the very first packet (`0-RTT` QUIC handshake). |
### Step 2: Configure Linode Cloud Firewall & DNS Records
### 2.3 Kernel TCP BBR & QUIC Socket Buffer Tuning (`/etc/sysctl.d/99-hyperstition-fastnet.conf`)
1. **Linode Cloud Firewall:** Allow inbound `TCP 443`, `UDP 443` (**HTTP/3 QUIC**), `TCP 80`, and restricted `TCP 22`.
2. **Linode DNS Manager (`hyperstitionstud.io`):**
- `A` (`@` and `www`) -> `<LINODE_IPV4>`
- `AAAA` (`@` and `www`) -> `<LINODE_IPV6>`
- `CAA` (`@`) -> `0 issue "letsencrypt.org"`
- `HTTPS` (`@`) -> `1 . alpn="h3,h2"`
```ini
# /etc/sysctl.d/99-hyperstition-fastnet.conf
### Step 3: Install OS Packages & Apply Kernel TCP BBR / QUIC Tuning (On VPS)
```bash
sudo apt update && sudo apt install -y git python3 python3-venv python3-pip brotli rsync curl caddy fonts-dejavu-core
sudo tee /etc/sysctl.d/99-hyperstition-fastnet.conf >/dev/null <<'EOF'
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
net.ipv4.tcp_fastopen = 3
@@ -107,235 +78,83 @@ net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.rmem_default = 2097152
net.core.wmem_default = 2097152
EOF
sudo sysctl --system
```
Apply with `sudo sysctl --system`.
---
## 3. Initial Per-Repository Installation on the VPS (`/srv/hyperstitionstud.io/repos/`)
### Step 4: Create Persistent Repo Root (`/srv/...`) & RAM-Backed `tmpfs` Mount (`/var/www/...`)
```bash
sudo apt update && sudo apt install -y git python3 python3-venv brotli rsync caddy fonts-dejavu-core
sudo mkdir -p /srv/hyperstitionstud.io/repos /var/www/hyperstitionstud.io/repos
sudo chown -R "$USER:$USER" /srv/hyperstitionstud.io
cd /srv/hyperstitionstud.io/repos
# Add 256 MB tmpfs mount to /etc/fstab (idempotent) and mount immediately
grep -q '/var/www/hyperstitionstud.io/repos' /etc/fstab || \
echo 'tmpfs /var/www/hyperstitionstud.io/repos tmpfs defaults,size=256M,mode=0755 0 0' | sudo tee -a /etc/fstab
sudo mount -a
```
### Step 5: Clone All 5 `git.libre.audio` Repositories & Initialize `.venv`
```bash
cd /srv/hyperstitionstud.io/repos
FORGE_HTTPS="https://git.libre.audio/seasharp"
# Clone all 5 repositories directly into their permanent per-repo install directories
git clone "${FORGE_HTTPS}/hyperstitionstudio-core.git"
git clone "${FORGE_HTTPS}/ingglish-hyperdope-gematria.git"
git clone "${FORGE_HTTPS}/technocapital-singularity-zoology.git"
git clone "${FORGE_HTTPS}/encyclopedia-knowledge-graph.git"
git clone -b feat/ingglish-aq-corpus "${FORGE_HTTPS}/ingglish-hyperdope-ci.git"
# Configure location-independent workspace.toml & Python virtual environment
cp hyperstitionstudio-core/workspace.example.toml ./workspace.toml
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r hyperstitionstudio-core/requirements.txt
.venv/bin/pip install --no-deps -e ./hyperstitionstudio-core
# Run pre-flight verification across the cloned install directories
# Verify environment & all 6 Knowledge Graph CI gates
.venv/bin/hs-doctor
.venv/bin/python3 hyperstitionstudio-core/tests/test_core_suite.py
.venv/bin/python3 encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --verify-only
```
---
## 4. Direct Per-Repository Caddy 2 Configuration (`/etc/caddy/Caddyfile`)
Each route in `/etc/caddy/Caddyfile` points directly to the corresponding repository install directory inside `/var/www/hyperstitionstud.io/repos/<repo-slug>`:
```caddyfile
# /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 -> /calc/*
handle_path /calc/* {
root * /var/www/hyperstitionstud.io/repos/ingglish-hyperdope-ci
file_server {
precompressed br gzip
}
}
redir /calc /calc/ 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
}
}
}
```
---
## 5. Per-Repository Atomic Sync, Pre-Compression & Boot Persistence (`sync-vps-repos.sh` + `systemd`)
### 5.1 `/srv/hyperstitionstud.io/sync-vps-repos.sh`
Pulls updates from `git.libre.audio` per repository install directory (or syncs existing disk clones on boot with `--no-pull`), verifies all 6 CI gates and SHA-256 locks, syncs each repository 1-to-1 into `/var/www/hyperstitionstud.io/repos/<repo>`, and pre-compresses all text/JS/JSON/XML/HTML assets with `brotli -q 11` and `gzip -9`:
### Step 6: Hydrate RAM Mount, Enable Boot Persistence & Reload Caddy
```bash
#!/usr/bin/env bash
# /srv/hyperstitionstud.io/sync-vps-repos.sh
# Usage:
# ./sync-vps-repos.sh all # Pull, audit & RAM-sync all 5 repos
# ./sync-vps-repos.sh encyclopedia-knowledge-graph # Pull, audit & RAM-sync a single repo
# ./sync-vps-repos.sh --no-pull # Boot-time RAM-sync without network fetch
set -euo pipefail
# 1. Hydrate /var/www/hyperstitionstud.io/repos, compile calc/db.json, and pre-compress (.br / .gz)
/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh --no-pull
REPOS_ROOT="/srv/hyperstitionstud.io/repos"
LIVE_REPOS="/var/www/hyperstitionstud.io/repos"
TARGET_REPO="${1:-all}"
# 2. Install systemd boot-time tmpfs hydration unit
sudo cp /srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/hyperstition-tmpfs-sync.service \
/etc/systemd/system/hyperstition-tmpfs-sync.service
sudo systemctl daemon-reload
sudo systemctl enable hyperstition-tmpfs-sync.service
REPOS=(
"hyperstitionstudio-core:main"
"ingglish-hyperdope-gematria:main"
"technocapital-singularity-zoology:main"
"encyclopedia-knowledge-graph:main"
"ingglish-hyperdope-ci: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
echo "[1/3] Fetching latest verified commits from git.libre.audio for ${repo} (${branch})..."
git -C "${REPOS_ROOT}/${repo}" fetch origin "${branch}" --tags
git -C "${REPOS_ROOT}/${repo}" merge --ff-only "origin/${branch}"
done
fi
echo "[2/3] Running hs-doctor & 6-Gate Knowledge Graph Verification..."
"${REPOS_ROOT}/.venv/bin/hs-doctor" >/dev/null
"${REPOS_ROOT}/.venv/bin/python3" "${REPOS_ROOT}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only >/dev/null
echo "[3/3] Syncing per-repo install directories into RAM (${LIVE_REPOS}) & pre-compressing (.br / .gz)..."
for entry in "${REPOS[@]}"; do
repo="${entry%%:*}"
if [[ "${TARGET_REPO}" != "all" && "${TARGET_REPO}" != "--no-pull" && "${TARGET_REPO}" != "${repo}" ]]; then
continue
fi
sudo mkdir -p "${LIVE_REPOS}/${repo}"
sudo rsync -a --delete --exclude='.git' "${REPOS_ROOT}/${repo}/" "${LIVE_REPOS}/${repo}/"
sudo find "${LIVE_REPOS}/${repo}" -type f \
\( -name "*.html" -o -name "*.js" -o -name "*.json" -o -name "*.graphml" -o -name "*.gexf" -o -name "*.canvas" -o -name "*.css" \) \
-exec gzip -9 -k -f {} \; \
-exec brotli -q 11 -k -f {} \;
done
echo "[OK] Per-repository RAM install directories ready at ${LIVE_REPOS}"
# 3. Install Caddyfile, validate syntax, and reload Caddy
sudo cp /srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/Caddyfile /etc/caddy/Caddyfile
sudo caddy validate --config /etc/caddy/Caddyfile
sudo systemctl reload caddy
```
### 5.2 `systemd` Boot-Time `tmpfs` Hydration Service (`/etc/systemd/system/hyperstition-tmpfs-sync.service`)
Ensures the RAM-backed `/var/www/hyperstitionstud.io/repos` mount is automatically populated from `/srv/hyperstitionstud.io/repos` on every VPS reboot before Caddy starts:
### Step 7: Verify Live Production Deployment (`test-first-deployment.sh`)
```ini
# /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
```bash
# Verify all 22 routes return HTTP 200 OK on https://hyperstitionstud.io
/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/test-first-deployment.sh https://hyperstitionstud.io
[Service]
Type=oneshot
ExecStart=/srv/hyperstitionstud.io/sync-vps-repos.sh --no-pull
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
# Measure DNS, QUIC/TLS handshake, and sub-15ms TTFB
curl -o /dev/null -s -w "DNS: %{time_namelookup}s | TLS/QUIC: %{time_appconnect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" https://hyperstitionstud.io/
```
Enable with: `sudo systemctl daemon-reload && sudo systemctl enable --now hyperstition-tmpfs-sync.service && sudo systemctl reload caddy`.
---
## 6. Post-Deploy Speed & Route Verification Checklist
## 4. Ongoing Per-Repository Updates on the VPS
To pull and deploy updates from `git.libre.audio` for all repositories or a single repository:
```bash
# 1. Verify Root Portal Homepage (/ -> hyperstitionstudio-core/site/index.html.br)
curl -I --http3 -H "Accept-Encoding: br" https://hyperstitionstud.io/
# Update all 5 repositories, run 6-gate audit, and sync to RAM:
/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh all
# 2. Verify Interactive Knowledge Graph Bundle (/graph/ -> encyclopedia-knowledge-graph/graph-data.js.br)
curl -I --http3 -H "Accept-Encoding: br" https://hyperstitionstud.io/graph/graph-data.js
# 3. Verify Direct Sibling Relative PDF Link Resolution (/technocapital-singularity-zoology/encyclopedia/...)
curl -I -H "Range: bytes=0-1023" https://hyperstitionstud.io/technocapital-singularity-zoology/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf
# 4. Measure DNS, TLS 1.3 / QUIC Handshake & Sub-15ms TTFB
curl -o /dev/null -s -w "DNS: %{time_namelookup}s | QUIC/TLS: %{time_appconnect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" https://hyperstitionstud.io/
# Or update a single repository in < 1.5 seconds:
/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh encyclopedia-knowledge-graph
```