161 lines
8.4 KiB
Markdown
161 lines
8.4 KiB
Markdown
# Production VPS & Git Operator Deployment Guide (`v2.1.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`)
|
||
- **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. Master 1-to-1 Mapping: `git.libre.audio` Repository -> VPS Install Dir -> Web Route
|
||
|
||
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>`:
|
||
|
||
| # | 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
|
||
```
|
||
|
||
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/
|
||
```
|
||
|
||
---
|
||
|
||
## 3. Production Linode / Akamai VPS First Deployment (Sequential Steps 1–7)
|
||
|
||
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):
|
||
|
||
### Step 1: Push Latest Verified Commits to `git.libre.audio` (On Workstation)
|
||
|
||
```bash
|
||
./push-all-to-git-libre-audio.sh
|
||
```
|
||
|
||
### Step 2: Configure Linode Cloud Firewall & DNS Records
|
||
|
||
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"`
|
||
|
||
### 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
|
||
net.ipv4.tcp_slow_start_after_idle = 0
|
||
net.core.rmem_max = 16777216
|
||
net.core.wmem_max = 16777216
|
||
net.core.rmem_default = 2097152
|
||
net.core.wmem_default = 2097152
|
||
EOF
|
||
sudo sysctl --system
|
||
```
|
||
|
||
### Step 4: Create Persistent Repo Root (`/srv/...`) & RAM-Backed `tmpfs` Mount (`/var/www/...`)
|
||
|
||
```bash
|
||
sudo mkdir -p /srv/hyperstitionstud.io/repos /var/www/hyperstitionstud.io/repos
|
||
sudo chown -R "$USER:$USER" /srv/hyperstitionstud.io
|
||
|
||
# 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"
|
||
|
||
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"
|
||
|
||
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
|
||
|
||
# Verify environment & all 6 Knowledge Graph CI gates
|
||
.venv/bin/hs-doctor
|
||
.venv/bin/python3 hyperstitionstudio-core/tests/test_core_suite.py
|
||
```
|
||
|
||
### Step 6: Hydrate RAM Mount, Enable Boot Persistence & Reload Caddy
|
||
|
||
```bash
|
||
# 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
|
||
|
||
# 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
|
||
|
||
# 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
|
||
```
|
||
|
||
### Step 7: Verify Live Production Deployment (`test-first-deployment.sh`)
|
||
|
||
```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
|
||
|
||
# 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/
|
||
```
|
||
|
||
---
|
||
|
||
## 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
|
||
# Update all 5 repositories, run 6-gate audit, and sync to RAM:
|
||
/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh all
|
||
|
||
# Or update a single repository in < 1.5 seconds:
|
||
/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/sync-vps-repos.sh encyclopedia-knowledge-graph
|
||
```
|