docs(vps): upgrade lightning-fast Linode/Akamai VPS deployment plan to v2.0.0 with direct per-repository install directory mapping and systemd tmpfs hydration (v1.0.0)
This commit is contained in:
1 parent
9e282db059
commit
ec382894a5
4 files changed
+670
-257
No files matched your search
@@ -1,59 +1,101 @@
|
||||
# Production Deployment Plan: Lightning-Fast `hyperstitionstud.io` Homepage & Knowledge Workbench on a Linode / Akamai Connected Cloud VPS (`v1.0.0`)
|
||||
# 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
|
||||
|
||||
- **Document ID:** `PLAN-LINODE-AKAMAI-VPS-HOMEPAGE-DEPLOYMENT` (`v1.0.0`)
|
||||
- **Document ID:** `PLAN-LINODE-AKAMAI-VPS-HOMEPAGE-DEPLOYMENT` (`v2.0.0` — Direct Per-Repository Install Directory Edition)
|
||||
- **Target Domain:** `https://hyperstitionstud.io` (and `https://www.hyperstitionstud.io` -> `308` redirect)
|
||||
- **Target Infrastructure:** Linode / Akamai Connected Cloud VPS (Debian 12 Bookworm or Ubuntu 24.04 LTS on AMD EPYC, IPv4 + IPv6 dual-stack, Cloud Firewall + Akamai Edge/DNS)
|
||||
- **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`)
|
||||
- **Offline Portability Preservation:** The deployed site uses the exact same static bundle (`index.html`, `graph-data.js`, `encyclopedia/*.pdf`) that runs offline over `file://`, with zero external CDN, font, or analytics dependencies.
|
||||
|
||||
---
|
||||
|
||||
## 1. Architectural Philosophy: Why Static RAM-Backed HTTP/3 Beats Dynamic Application Servers
|
||||
## 1. Architectural Overview: 1-to-1 Per-Repository Install Directories in RAM (`tmpfs`)
|
||||
|
||||
Every user-facing artifact across the workspace—the **388-node Interactive Encyclopedia Knowledge Graph**, the **22-Volume Alphabetized PDF Encyclopedia (`122` pages)**, the **282-Term Comprehensive Glossary**, the **Assemblage Builds `ETI` Tier List**, the **Gen IV Pokedex Field-Scanner Cards**, the **5-Episode Audio Podcast Series**, and the **Hyperdope-Gematria `AQ` Calculator**—is already deterministically pre-compiled before deployment.
|
||||
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:
|
||||
|
||||
Therefore, the production VPS requires **zero runtime Python, Node.js, or database processes in the HTTP request path**:
|
||||
```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)
|
||||
```
|
||||
|
||||
1. **Zero Dynamic Compute in the Request Path:**
|
||||
All Python compilation (`classify_technocapital_singularity.py`, `build_encyclopedia_knowledge_graph.py`, `hs-pdf-build`, `hs-doctor`) runs at **build/release time**, never on incoming HTTP requests.
|
||||
2. **Pre-Compressed Static Assets (`Brotli -q 11` & `Gzip -9`):**
|
||||
Every `.html`, `.js`, `.css`, `.json`, `.svg`, `.graphml`, `.gexf`, and `.canvas` artifact is compressed once during release staging (`graph-data.js` shrinks from `~245 KB` raw to `~32 KB` `.br`). The web server sends the pre-built `.br` file directly without spending CPU cycles compressing responses on the fly.
|
||||
3. **`tmpfs` In-Memory Web Root (`/var/www/hyperstitionstud.io/live`):**
|
||||
Excluding optional `.mp3` audio streams, the entire compiled static site (HTML, JS, JSON, SVG, PNGs, and all 22 Encyclopedia PDFs) totals **`~34 MB`**. Mounting `/var/www/hyperstitionstud.io/live` on a `256 MB` RAM-backed `tmpfs` (and keeping `.mp3` podcasts in `/srv/hyperstitionstud.io/media/podcast` with HTTP `206` byte-range streaming) guarantees that every page load, graph query, and PDF open is served directly from system RAM.
|
||||
### 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.
|
||||
|
||||
---
|
||||
|
||||
## 2. Linode / Akamai VPS Provisioning, DNS & Kernel Network Tuning
|
||||
## 2. Linode / Akamai VPS Provisioning, Firewall, DNS & Kernel Tuning
|
||||
|
||||
### 2.1 Recommended Linode Instance & Storage Layout
|
||||
### 2.1 Instance, `tmpfs` RAM Mount & Cloud Firewall
|
||||
|
||||
| Resource | Specification | Rationale |
|
||||
| :--- | :--- | :--- |
|
||||
| **Instance Plan** | **Linode Dedicated 4 GB** or **Shared 2 GB / 4 GB** (`2 vCPU`, `4 GB RAM`, `80 GB NVMe`, `4 TB Transfer`) | `256 MB` `tmpfs` holds the entire HTML/JS/JSON/PDF corpus in RAM with `> 3 GB` headroom for OS page cache and build staging. |
|
||||
| **Region** | `us-iad` (Washington, DC) or `us-east` (Newark) | Lowest transatlantic + North American fiber latency on Akamai's backbone. |
|
||||
| **Base OS** | **Debian 12 (Bookworm)** or **Ubuntu 24.04 LTS** (`Linux 6.8+` kernel) | Native kernel TLS (`ktls`), TCP BBR congestion control, and official Caddy 2 / Nginx Brotli packages. |
|
||||
| **Linode Cloud Firewall** | Inbound allow **only**:<br/>• `TCP 443` (HTTPS / HTTP/2)<br/>• `UDP 443` (**HTTP/3 QUIC** — critical!)<br/>• `TCP 80` (ACME HTTP-01 & `308` redirect to HTTPS)<br/>• `TCP 22` (SSH, restricted to operator IP/WireGuard) | Blocks all unsolicited port scans at Akamai's hypervisor edge before packets reach the VPS NIC. |
|
||||
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.
|
||||
|
||||
### 2.2 Linode DNS Manager Records (`hyperstitionstud.io`)
|
||||
|
||||
Configure in Linode DNS Manager (or Akamai Edge DNS) with `TTL = 300` during cutover, then `TTL = 3600`:
|
||||
|
||||
| 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 (redirects `308` to apex) |
|
||||
| `AAAA` | `www` | `<LINODE_IPV6>` | `www` IPv6 (redirects `308` to apex) |
|
||||
| `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"` | **SVCB/HTTPS DNS record (RFC 9460):** Instructs browsers to connect via **HTTP/3 (`h3`)** on the very first packet without waiting for an HTTP/1.1 or HTTP/2 `Alt-Svc` header! |
|
||||
| `HTTPS` | `@` | `1 . alpn="h3,h2"` | **RFC 9460 SVCB/HTTPS record:** Browser negotiates **HTTP/3 (`h3`)** on the very first packet (`0-RTT` QUIC handshake). |
|
||||
|
||||
### 2.3 Linux Kernel TCP BBR & QUIC UDP Buffer Tuning (`/etc/sysctl.d/99-hyperstition-fastnet.conf`)
|
||||
|
||||
Apply on the Linode VPS (`sudo sysctl --system`) to eliminate TCP slow-start bottlenecks and UDP buffer drops under HTTP/3 QUIC bursts:
|
||||
### 2.3 Kernel TCP BBR & QUIC Socket Buffer Tuning (`/etc/sysctl.d/99-hyperstition-fastnet.conf`)
|
||||
|
||||
```ini
|
||||
# /etc/sysctl.d/99-hyperstition-fastnet.conf
|
||||
@@ -66,65 +108,48 @@ net.core.wmem_max = 16777216
|
||||
net.core.rmem_default = 2097152
|
||||
net.core.wmem_default = 2097152
|
||||
```
|
||||
Apply with `sudo sysctl --system`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Unified Site URL Map & Landing Homepage Design (`https://hyperstitionstud.io`)
|
||||
## 3. Initial Per-Repository Installation on the VPS (`/srv/hyperstitionstud.io/repos/`)
|
||||
|
||||
```text
|
||||
/var/www/hyperstitionstud.io/live/ (256 MB tmpfs RAM mount — 0 disk I/O)
|
||||
├── index.html # Lightning-fast (< 8 KB inline CSS/SVG) Portal Homepage
|
||||
├── graph/ # Interactive Encyclopedia Knowledge Graph Workbench
|
||||
│ ├── index.html # 388 Nodes, 1,282 Edges (encyclopedia_base_path = "/encyclopedia")
|
||||
│ ├── graph-data.js (+ .br / .gz) # ~32 KB over the wire via Brotli-11
|
||||
│ ├── encyclopedia-graph.json (+ .br) # Raw property graph JSON
|
||||
│ ├── encyclopedia-graph.graphml (+ .br) # Gephi / Cytoscape / yEd export
|
||||
│ ├── encyclopedia-graph.gexf (+ .br) # GEXF 1.3 export
|
||||
│ ├── encyclopedia.canvas (+ .br) # Obsidian JSON Canvas 1.0 (282 cards, 1,120 edges)
|
||||
│ ├── atlas-mode1-trophic-food-web.png # 1600x1060 Static Atlas Board 1
|
||||
│ ├── atlas-mode2-concentric-eti-radar.png# 1600x1060 Static Atlas Board 2 (S+ -> D Periphery)
|
||||
│ └── atlas-mode3-bipartite-g1-funnel.png # 1600x1060 Static Atlas Board 3
|
||||
├── encyclopedia/ # 9 Ontological Divisions (00..08) & 22 PDF Volumes (122 Pages)
|
||||
│ ├── encyclopedia-manifest.json (+ .br)
|
||||
│ ├── 00-index-and-ontological-atlas/*.pdf
|
||||
│ └── ... (01 through 08 division PDFs)
|
||||
├── zoology/ # Core Dossiers, Tier Lists, Glossary & Architecture Diagrams
|
||||
│ ├── tier-list-technocapital-assemblage-builds.{pdf,png}
|
||||
│ ├── technocapital-singularity-zoology-comprehensive-glossary.pdf
|
||||
│ ├── cross-repo-dependency-and-audit-flow-diagram.{html,png,pdf}
|
||||
│ ├── OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.pdf
|
||||
│ └── dossiers/65..69-dossier-*.md
|
||||
├── pokedex/ # Gen IV INFO Pokedex Field-Scanner Cards & Manifest
|
||||
│ └── meme_1_custom_pokedex_technocapital_zoology_m7_129_125.{png,pdf}
|
||||
├── calc/ # Static Hyperdope-Gematria Browser Workbench
|
||||
│ ├── index.html
|
||||
│ └── db.json (+ .br / .gz)
|
||||
└── podcast/ # Symlinked to /srv/hyperstitionstud.io/media/podcast (NVMe)
|
||||
└── podcast-ep01..05-*.{mp3,pdf} # Served with HTTP 206 Byte-Range streaming
|
||||
```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
|
||||
|
||||
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
|
||||
.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
|
||||
```
|
||||
|
||||
### 3.1 Homepage (`/` -> `index.html`) Speed & UX Specification
|
||||
- **Single-Packet HTML Delivery (`< 10 KB` raw, `< 3.2 KB` Brotli):**
|
||||
- Inline critical CSS using the exact dark-mode palette (`--bg-canvas: #020617`, `--bg-panel: #0f172a`, `--accent-cyan: #22d3ee`, `--accent-red: #ff4d4d`, `--accent-gold: #f5c630`).
|
||||
- Zero external `<link>` stylesheets, zero external web fonts (`'DejaVu Sans Mono', 'JetBrains Mono', ui-monospace, monospace`), and zero third-party tracking scripts.
|
||||
- **Six Instant-Launch Bento Cards Above the Fold:**
|
||||
1. **Interactive Encyclopedia Knowledge Graph (`/graph/`):** Live node/edge badge (`388 Nodes • 1,282 Edges • 4 Spatial Modes`), direct launch into `Mode 2: Concentric ETI Tier-Ring Radar (S+ -> D Periphery)`, and download links for `.json`, `.graphml`, `.gexf`, and `.canvas`.
|
||||
2. **22-Volume PDF Encyclopedia & 282-Term Glossary (`/encyclopedia/`):** Direct division matrix (`Divisions 00–08`, `122 Pages`) + 1-click PDF drawer.
|
||||
3. **Assemblage Builds `ETI` Tier List (`/zoology/tier-list-technocapital-assemblage-builds.png` & `.pdf`):** `S+` (`#1 S1` `93 ETI`, `#2 S2` `90 ETI`) through `D Periphery` (`49 ETI`) visual scorecard.
|
||||
4. **Gen IV INFO Pokedex Field-Scanner (`/pokedex/`):** `M7_candidate_2026_11_28` (`AWFLAIN == RUHSHA == BLAKWEL == 129`, `DOUNZ == KAPATAL == KAPCHER == 125`).
|
||||
5. **The Singularity Field Guide Audio Podcast (`/podcast/`):** Native HTML5 `<audio preload="metadata">` player with companion PDF transcripts for Episodes `01–05`.
|
||||
6. **Base-36 `AQ` & Phonemic `Ingglish` Calculator (`/calc/`):** Client-side cipher evaluation workbench.
|
||||
- **Smart Prefetching (`<link rel="prefetch">`):**
|
||||
The homepage includes `<link rel="prefetch" href="/graph/graph-data.js" as="script">` so while the visitor reads the homepage header for 1 second, the `32 KB` Brotli-compressed Knowledge Graph dataset is already warmed in the browser cache—making clicking `/graph/` render all 388 nodes in **0 ms network wait time**.
|
||||
|
||||
---
|
||||
|
||||
## 4. Web Server Configuration: Caddy 2 (`HTTP/3` + Pre-Compressed `br`/`gzip` + Immutable Caching)
|
||||
## 4. Direct Per-Repository Caddy 2 Configuration (`/etc/caddy/Caddyfile`)
|
||||
|
||||
Caddy 2 (`sudo apt install caddy`) provides automatic TLS 1.3 certificate management, native HTTP/3 (`QUIC`), kernel `sendfile`, and first-class `precompressed br gzip` support in a 35-line `/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
|
||||
# /etc/caddy/Caddyfile — Direct Per-Repository Install Directory Routing (HTTP/3 + Precompressed Brotli-11)
|
||||
{
|
||||
servers {
|
||||
protocols h1 h2 h3
|
||||
@@ -136,15 +161,8 @@ www.hyperstitionstud.io {
|
||||
}
|
||||
|
||||
hyperstitionstud.io {
|
||||
root * /var/www/hyperstitionstud.io/live
|
||||
encode zstd gzip
|
||||
|
||||
# Serve pre-built .br (Brotli-11) and .gz files from RAM with 0 CPU overhead
|
||||
file_server {
|
||||
precompressed br gzip
|
||||
}
|
||||
|
||||
# Advertise HTTP/3 QUIC and enforce strict security headers
|
||||
header {
|
||||
Alt-Svc "h3=\":443\"; ma=2592000"
|
||||
Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
|
||||
@@ -153,108 +171,171 @@ hyperstitionstud.io {
|
||||
-Server
|
||||
}
|
||||
|
||||
# Long-lived caching for heavy static PDFs, PNGs, and MP3s (with ETag + HTTP 206 Byte-Range)
|
||||
@immutable_media path *.pdf *.png *.mp3 *.graphml *.gexf *.canvas
|
||||
header @immutable_media Cache-Control "public, max-age=86400, stale-while-revalidate=604800"
|
||||
|
||||
# Instant revalidation for HTML & graph-data.js
|
||||
@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. Atomic Build, Pre-Compression & RAM-Sync Release Script (`deploy-hyperstitionstud-io.sh`)
|
||||
## 5. Per-Repository Atomic Sync, Pre-Compression & Boot Persistence (`sync-vps-repos.sh` + `systemd`)
|
||||
|
||||
The operator deploys updates using a deterministic, zero-downtime release script that:
|
||||
1. Runs `hs-doctor` and `build_encyclopedia_knowledge_graph.py --verify-only` (aborting immediately if any of the 6 CI gates or SHA-256 glossary isolation locks fail).
|
||||
2. Assembles the release directory `/srv/hyperstitionstud.io/releases/<UTC_TIMESTAMP>`, setting `encyclopedia_base_path = "/encyclopedia"` in the deployed `/graph/graph-data.js` so PDF links resolve cleanly from `/graph/`.
|
||||
3. Pre-compresses all text/JSON/JS/XML/HTML artifacts at maximum compression (`brotli -q 11 -k` and `gzip -9 -k`).
|
||||
4. Atomically flips `/srv/hyperstitionstud.io/current` and `rsync --delete` syncs the release into the `/var/www/hyperstitionstud.io/live` `tmpfs` RAM mount in `< 50 ms`.
|
||||
### 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`:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
# deploy-hyperstitionstud-io.sh — Atomic Pre-Compressed RAM-Backed Release Builder
|
||||
# /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
|
||||
|
||||
WORKSPACE_DIR="${WORKSPACE_DIR:-/workspace}"
|
||||
RELEASE_ROOT="/srv/hyperstitionstud.io"
|
||||
LIVE_TMPFS="/var/www/hyperstitionstud.io/live"
|
||||
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
|
||||
REL_DIR="${RELEASE_ROOT}/releases/${STAMP}"
|
||||
REPOS_ROOT="/srv/hyperstitionstud.io/repos"
|
||||
LIVE_REPOS="/var/www/hyperstitionstud.io/repos"
|
||||
TARGET_REPO="${1:-all}"
|
||||
|
||||
echo "[1/5] Running hs-doctor & 6-Gate Knowledge Graph Verification..."
|
||||
hs-doctor >/dev/null
|
||||
python3 "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py" --verify-only >/dev/null
|
||||
|
||||
echo "[2/5] Staging static release bundle at ${REL_DIR}..."
|
||||
mkdir -p "${REL_DIR}"/{graph,encyclopedia,zoology/dossiers,pokedex,podcast,schemas/v1}
|
||||
|
||||
# Copy Knowledge Graph Workbench & rewrite encyclopedia_base_path for /encyclopedia web route
|
||||
cp -a "${WORKSPACE_DIR}/encyclopedia-knowledge-graph"/{index.html,encyclopedia-graph.*,encyclopedia.canvas,atlas-mode*.png} "${REL_DIR}/graph/"
|
||||
python3 - <<PY
|
||||
import json
|
||||
from pathlib import Path
|
||||
src = Path("${WORKSPACE_DIR}/encyclopedia-knowledge-graph/encyclopedia-graph.json")
|
||||
data = json.loads(src.read_text(encoding="utf-8"))
|
||||
data["encyclopedia_base_path"] = "/encyclopedia"
|
||||
j_str = json.dumps(data, separators=(",", ":"), ensure_ascii=False)
|
||||
(Path("${REL_DIR}/graph/encyclopedia-graph.json")).write_text(j_str, encoding="utf-8")
|
||||
(Path("${REL_DIR}/graph/graph-data.js")).write_text(
|
||||
"window.HyperstitionStudio=window.HyperstitionStudio||{};"
|
||||
f"window.HyperstitionStudio.EncyclopediaGraphData={j_str};"
|
||||
"window.ENCYCLOPEDIA_GRAPH_DATA=window.HyperstitionStudio.EncyclopediaGraphData;",
|
||||
encoding="utf-8",
|
||||
REPOS=(
|
||||
"hyperstitionstudio-core:main"
|
||||
"ingglish-hyperdope-gematria:main"
|
||||
"technocapital-singularity-zoology:main"
|
||||
"encyclopedia-knowledge-graph:main"
|
||||
"ingglish-hyperdope-ci:feat/ingglish-aq-corpus"
|
||||
)
|
||||
PY
|
||||
|
||||
# Copy 22-Volume PDF Encyclopedia, Zoology Reports, Schemas & Pokedex
|
||||
cp -a "${WORKSPACE_DIR}/technocapital-singularity-zoology/encyclopedia"/* "${REL_DIR}/encyclopedia/"
|
||||
cp -a "${WORKSPACE_DIR}/technocapital-singularity-zoology/dossiers"/*.md "${REL_DIR}/zoology/dossiers/"
|
||||
cp -a "${WORKSPACE_DIR}/technocapital-singularity-zoology"/tier-list-technocapital-assemblage-builds.{pdf,png} "${REL_DIR}/zoology/"
|
||||
cp -a "${WORKSPACE_DIR}/technocapital-singularity-zoology"/technocapital-singularity-zoology-comprehensive-glossary.pdf "${REL_DIR}/zoology/"
|
||||
cp -a "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.pdf" "${REL_DIR}/zoology/"
|
||||
cp -a "${WORKSPACE_DIR}/encyclopedia-knowledge-graph/docs/cross-repo-dependency-and-audit-flow-diagram".{html,png,pdf} "${REL_DIR}/zoology/"
|
||||
cp -a "${WORKSPACE_DIR}/hyperstitionstudio-core/schemas/v1"/*.json "${REL_DIR}/schemas/v1/"
|
||||
cp -a "${WORKSPACE_DIR}/memes"/meme_1_custom_pokedex_technocapital_zoology_m7_129_125.{png,pdf} "${REL_DIR}/pokedex/"
|
||||
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 "[3/5] Pre-compressing HTML, JS, JSON, XML & Canvas assets with Brotli (-q 11) and Gzip (-9)..."
|
||||
find "${REL_DIR}" -type f \( -name "*.html" -o -name "*.js" -o -name "*.json" -o -name "*.graphml" -o -name "*.gexf" -o -name "*.canvas" -o -name "*.md" \) | while read -r f; do
|
||||
gzip -9 -k -f "$f"
|
||||
if command -v brotli >/dev/null 2>&1; then
|
||||
brotli -q 11 -k -f "$f"
|
||||
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 "[4/5] Flipping atomic symlink ${RELEASE_ROOT}/current -> ${REL_DIR}..."
|
||||
ln -sfn "${REL_DIR}" "${RELEASE_ROOT}/current"
|
||||
|
||||
echo "[5/5] Syncing into RAM-backed ${LIVE_TMPFS}..."
|
||||
mkdir -p "${LIVE_TMPFS}"
|
||||
rsync -a --delete "${RELEASE_ROOT}/current/" "${LIVE_TMPFS}/"
|
||||
echo "[OK] Deployed release ${STAMP} to ${LIVE_TMPFS}"
|
||||
echo "[OK] Per-repository RAM install directories ready at ${LIVE_REPOS}"
|
||||
```
|
||||
|
||||
### 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:
|
||||
|
||||
```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
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/srv/hyperstitionstud.io/sync-vps-repos.sh --no-pull
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
Enable with: `sudo systemctl daemon-reload && sudo systemctl enable --now hyperstition-tmpfs-sync.service && sudo systemctl reload caddy`.
|
||||
|
||||
---
|
||||
|
||||
## 6. Post-Deploy Verification & Benchmark Checklist
|
||||
## 6. Post-Deploy Speed & Route Verification Checklist
|
||||
|
||||
After running `deploy-hyperstitionstud-io.sh` on the Linode VPS, verify all 5 speed and integrity gates:
|
||||
```bash
|
||||
# 1. Verify Root Portal Homepage (/ -> hyperstitionstudio-core/site/index.html.br)
|
||||
curl -I --http3 -H "Accept-Encoding: br" https://hyperstitionstud.io/
|
||||
|
||||
1. **HTTP/3 QUIC & Brotli Verification:**
|
||||
```bash
|
||||
curl -I --http3 -H "Accept-Encoding: br" https://hyperstitionstud.io/graph/graph-data.js
|
||||
```
|
||||
Confirm `HTTP/3 200`, `content-encoding: br`, and `content-length` around `32000` bytes (`~87%` compression ratio).
|
||||
2. **Sub-15ms TTFB Latency Benchmark:**
|
||||
```bash
|
||||
curl -o /dev/null -s -w "DNS: %{time_namelookup}s | TLS: %{time_appconnect}s | TTFB: %{time_starttransfer}s | Total: %{time_total}s\n" https://hyperstitionstud.io/
|
||||
```
|
||||
3. **PDF Byte-Range Streaming Verification (Encyclopedia Volumes):**
|
||||
```bash
|
||||
curl -I -H "Range: bytes=0-1023" https://hyperstitionstud.io/encyclopedia/00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z.pdf
|
||||
```
|
||||
Confirm `HTTP/2 206` (or `HTTP/3 206`) and `accept-ranges: bytes`.
|
||||
4. **Offline Portability Parity:**
|
||||
Downloading `/graph/index.html` and `/graph/graph-data.js` still works 100% offline with zero external CDN or font requests.
|
||||
# 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/
|
||||
```
|
||||
Reference in new issue
Block a user