Files
technocapital-singularity-z…/docs/PLAN-GIT-LIBRE-AUDIO-REPO-SYNC-FOR-VPS-INSTALL-DIRS.md
T

291 lines
16 KiB
Markdown

# Plan: Updating `git.libre.audio` Repositories for Direct Per-Repository Install Directory Mapping on the Linode / Akamai VPS (`v1.0.0`)
- **Document ID:** `PLAN-GIT-LIBRE-AUDIO-REPO-SYNC-FOR-VPS-INSTALL-DIRS` (`v1.0.0`)
- **Git Forge Authority:** `git.libre.audio` (SSH push: `ssh://git@git.libre.audio:2222/seasharp/<repo>.git`; Public HTTPS clone/pull on VPS: `https://git.libre.audio/seasharp/<repo>.git`)
- **Target Production Domain:** `https://hyperstitionstud.io` (Linode / Akamai Connected Cloud VPS)
- **Core Architectural Principle:** **1-to-1 Repository-to-Install-Directory Mapping on the VPS (`/srv/hyperstitionstud.io/repos/<repo-slug>`)** — Caddy routes each URL path on `https://hyperstitionstud.io` directly to the corresponding cloned repository directory on the VPS, eliminating ad-hoc file copying across repositories and enabling independent, atomic `git pull --ff-only` updates per repository.
---
## 1. Master Mapping Matrix: Source `/workspace` Repo -> `git.libre.audio` Remote -> VPS Install Dir -> Web Route
Every sibling repository in `/workspace` maps deterministically to a single repository under `seasharp` on `git.libre.audio`, a dedicated clone directory under `/srv/hyperstitionstud.io/repos/` on the Linode VPS, and a direct Caddy route on `https://hyperstitionstud.io`:
| # | Local `/workspace` Source Dir | `git.libre.audio` SSH Push URL (`origin`) | `git.libre.audio` Public HTTPS Clone URL (Used by VPS) | Dedicated VPS Install Directory (`/srv/hyperstitionstud.io/repos/*`) | Direct Web Route(s) on `https://hyperstitionstud.io` |
| :- | :--- | :--- | :--- | :--- | :--- |
| **1** | `/workspace/hyperstitionstudio-core`<br/>(`main`, `tag: v1.2.0`) | `ssh://git@git.libre.audio:2222/seasharp/hyperstitionstudio-core.git` | `https://git.libre.audio/seasharp/hyperstitionstudio-core.git` | `/srv/hyperstitionstud.io/repos/hyperstitionstudio-core` | • `/` (`site/index.html` Portal Homepage)<br/>• `/schemas/v1/*` (`schemas/v1/*.schema.json`) |
| **2** | `/workspace/ingglish-hyperdope-gematria`<br/>(`main`, `commit: 3b5bb05`) | `ssh://git@git.libre.audio:2222/seasharp/ingglish-hyperdope-gematria.git` | `https://git.libre.audio/seasharp/ingglish-hyperdope-gematria.git` | `/srv/hyperstitionstud.io/repos/ingglish-hyperdope-gematria` | • `/archive/*` (`ingglish-aq-archive/`) |
| **3** | `/workspace/technocapital-singularity-zoology`<br/>(`main`, `tag: v1.7.0`) | `ssh://git@git.libre.audio:2222/seasharp/technocapital-singularity-zoology.git` | `https://git.libre.audio/seasharp/technocapital-singularity-zoology.git` | `/srv/hyperstitionstud.io/repos/technocapital-singularity-zoology` | • `/encyclopedia/*` (`encyclopedia/`)<br/>• `/technocapital-singularity-zoology/encyclopedia/*` (`encyclopedia/` — direct sibling link target!)<br/>• `/zoology/*` (root PDFs, tier list, glossary, `dossiers/`) |
| **4** | `/workspace/encyclopedia-knowledge-graph`<br/>(`main`, `tag: v1.0.0`) | `ssh://git@git.libre.audio:2222/seasharp/encyclopedia-knowledge-graph.git` | `https://git.libre.audio/seasharp/encyclopedia-knowledge-graph.git` | `/srv/hyperstitionstud.io/repos/encyclopedia-knowledge-graph` | • `/graph/*` (root `index.html`, `graph-data.js`, `atlas-mode*.png`, `.json`, `.graphml`, `.gexf`, `.canvas`, `docs/`) |
| **5** | `/workspace/hyperdope-ci-build`<br/>(`feat/ingglish-aq-corpus`) | `ssh://git@git.libre.audio:2222/seasharp/ingglish-hyperdope-ci.git` | `https://git.libre.audio/seasharp/ingglish-hyperdope-ci.git` | `/srv/hyperstitionstud.io/repos/ingglish-hyperdope-ci` | • `/calc/*` (root `index.html`, `calc/*.js`, `db.json`, `config.default.js`) |
---
## 2. Why Per-Repository Install Directories on the VPS Eliminate Build & Path Friction
1. **Zero File-Copy Drift Between Git and the Live Web Root:**
Instead of a deployment script cherry-picking individual `.html`, `.js`, `.png`, and `.pdf` files out of multiple repositories and copying them into a synthetic directory tree, each repository on the VPS **is** its own install directory (`/srv/hyperstitionstud.io/repos/<repo>`). What is committed and tagged in Git on `git.libre.audio` is byte-for-byte what exists in `/srv/hyperstitionstud.io/repos/<repo>`.
2. **Native Sibling Relative-Link Compatibility (`../technocapital-singularity-zoology/encyclopedia/`):**
Inside `encyclopedia-knowledge-graph/index.html`, clicking `"Open Encyclopedia Volume PDF"` links to `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf`.
When the user visits `https://hyperstitionstud.io/graph/index.html`, the browser resolves `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf` to:
`https://hyperstitionstud.io/technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf`!
By mapping `/technocapital-singularity-zoology/*` (as well as the short alias `/encyclopedia/*`) directly to `/srv/hyperstitionstud.io/repos/technocapital-singularity-zoology` in Caddy, **zero rewriting of `graph-data.js` or `index.html` is needed on the VPS**—the exact same unmodified repository works via `file://`, via local `python3 -m http.server`, and on `https://hyperstitionstud.io/graph/`!
3. **Independent Per-Repo Updates & Rollbacks:**
Updating the Knowledge Graph on the VPS requires only:
`git -C /srv/hyperstitionstud.io/repos/encyclopedia-knowledge-graph fetch origin && git -C /srv/hyperstitionstud.io/repos/encyclopedia-knowledge-graph checkout v1.0.0`
without touching the 22-Volume PDF Encyclopedia repo or the Calculator repo.
---
## 3. Phase 1 (Git Operator on Workstation): Prepare & Push All 5 Repositories to `git.libre.audio`
### Step 1.1: Include the Static Portal Homepage (`site/index.html`) in `hyperstitionstudio-core`
So that even the root homepage (`https://hyperstitionstud.io/`) comes directly from a version-controlled repository install directory (`/srv/hyperstitionstud.io/repos/hyperstitionstudio-core/site/index.html`) rather than an unversioned file on the VPS:
- Commit the `< 8 KB` inline-CSS/SVG dark-mode portal homepage at `/workspace/hyperstitionstudio-core/site/index.html`, linking directly to `/graph/`, `/encyclopedia/`, `/zoology/`, `/archive/`, and `/calc/`.
### Step 1.2: Configure `git.libre.audio` Remotes & Verify Pre-Push Gates Across All 5 Repositories
Run the pre-push verification suite first to confirm all 5 repositories are clean and pass all 6 Knowledge Graph & SHA-256 isolation gates:
```bash
# 1. Verify environment, 4,897 offline CMUdict entries, and SHA-256 locks
hs-doctor
# 2. Run the 6-suite core library unit & integration tests
python3 /workspace/hyperstitionstudio-core/tests/test_core_suite.py
# 3. Verify all 6 Knowledge Graph gates
python3 /workspace/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --verify-only
```
### Step 1.3: Create Missing Repositories on `git.libre.audio` (If Not Yet Created) & Push in Dependency Order
Ensure the three new repositories exist under `seasharp` on `git.libre.audio` (`Visibility: Public` so the Linode VPS can clone over `https://` without storing SSH private keys on the web server):
- `seasharp/hyperstitionstudio-core`
- `seasharp/technocapital-singularity-zoology`
- `seasharp/encyclopedia-knowledge-graph`
*(Note: `seasharp/ingglish-hyperdope-gematria` and `seasharp/ingglish-hyperdope-ci` already exist on `git.libre.audio` and are already configured as `origin` in their respective `/workspace` folders).*
Then execute the topological push sequence:
```bash
FORGE_SSH="ssh://git@git.libre.audio:2222/seasharp"
# 1. Push Repo #1: hyperstitionstudio-core (main + tag v1.2.0)
/workspace/hyperstitionstudio-core/push-to-origin.sh "${FORGE_SSH}/hyperstitionstudio-core.git"
# 2. Push Repo #2: ingglish-hyperdope-gematria (main, commit 3b5bb05 with Dossiers 48-70)
cd /workspace/ingglish-hyperdope-gematria
git push -u origin main
# 3. Push Repo #3: technocapital-singularity-zoology (main + tags v1.0.0..v1.7.0)
cd /workspace/technocapital-singularity-zoology
git remote add origin "${FORGE_SSH}/technocapital-singularity-zoology.git" 2>/dev/null || \
git remote set-url origin "${FORGE_SSH}/technocapital-singularity-zoology.git"
git push -u origin main
git push origin --tags
# 4. Push Repo #4: encyclopedia-knowledge-graph (main + tag v1.0.0)
/workspace/encyclopedia-knowledge-graph/push-to-origin.sh "${FORGE_SSH}/encyclopedia-knowledge-graph.git"
# 5. Push Repo #5: hyperdope-ci-build (feat/ingglish-aq-corpus -> seasharp/ingglish-hyperdope-ci.git)
cd /workspace/hyperdope-ci-build
git push -u origin feat/ingglish-aq-corpus
```
---
## 4. Phase 2 (VPS Operator on Linode / Akamai): Per-Repository Install Layout & Direct Caddy Routing
### Step 2.1: Clone Each `git.libre.audio` Repository into `/srv/hyperstitionstud.io/repos/<repo>`
On the Linode VPS, create `/srv/hyperstitionstud.io/repos` and clone each repository over public HTTPS directly into its permanent install directory:
```bash
sudo mkdir -p /srv/hyperstitionstud.io/repos
sudo chown -R "$USER:$USER" /srv/hyperstitionstud.io
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"
# Initialize local workspace.toml and Python venv at the /srv/hyperstitionstud.io/repos parent level
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 all 4 repos and SHA-256 locks directly inside /srv/hyperstitionstud.io/repos
.venv/bin/hs-doctor
.venv/bin/python3 encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --verify-only
```
### Step 2.2: Pre-Compress In-Place Inside Each Repo Install Dir (& Optional `tmpfs` Mirror)
Run a single non-destructive sidecar compression pass that creates `.br` (`brotli -q 11 -k`) and `.gz` (`gzip -9 -k`) sidecar files alongside the tracked `.html`, `.js`, `.json`, `.graphml`, `.gexf`, and `.canvas` files inside `/srv/hyperstitionstud.io/repos/` (with `*.br` and `*.gz` listed in `/srv/hyperstitionstud.io/repos/.git/info/exclude` or `.gitignore` so `git status` remains 100% clean!), or sync `/srv/hyperstitionstud.io/repos/` 1-to-1 into the RAM-backed `/var/www/hyperstitionstud.io/repos/` `tmpfs` mount:
```bash
# Sync all 5 repo install directories 1-to-1 into RAM-backed tmpfs (/var/www/hyperstitionstud.io/repos/<repo>)
sudo mkdir -p /var/www/hyperstitionstud.io/repos
sudo rsync -a --delete --exclude='.git' --exclude='.venv' \
/srv/hyperstitionstud.io/repos/ /var/www/hyperstitionstud.io/repos/
# Generate .br and .gz precompressed sidecars inside the RAM mount
sudo find /var/www/hyperstitionstud.io/repos -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 {} \;
```
### Step 2.3: Caddy Configuration Referencing Each Repository Install Directory Directly (`/etc/caddy/Caddyfile`)
Every route in `/etc/caddy/Caddyfile` maps explicitly to its owning repository install directory under `/var/www/hyperstitionstud.io/repos/<repo-slug>` (or `/srv/hyperstitionstud.io/repos/<repo-slug>`):
```caddyfile
# /etc/caddy/Caddyfile — Direct Per-Repository Install Directory Routing
{
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
}
# 1. Repo: 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: technocapital-singularity-zoology -> /encyclopedia/*, /zoology/*, and sibling path
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: 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: 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: 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. Phase 3: Per-Repository Update & Audit Workflow on the VPS (`sync-vps-repos.sh`)
Whenever any repository on `git.libre.audio` receives a new commit or tag, the VPS operator updates either all repositories or a single named repository (`./sync-vps-repos.sh encyclopedia-knowledge-graph`) using the following script:
```bash
#!/usr/bin/env bash
# /srv/hyperstitionstud.io/sync-vps-repos.sh
# Pulls latest verified commits from git.libre.audio per repo install dir, runs 6-gate audit,
# and syncs updated repo(s) into the RAM-backed /var/www/hyperstitionstud.io/repos/ tmpfs mount.
set -euo pipefail
REPOS_ROOT="/srv/hyperstitionstud.io/repos"
LIVE_REPOS="/var/www/hyperstitionstud.io/repos"
TARGET_REPO="${1:-all}"
REPOS=(
"hyperstitionstudio-core:main"
"ingglish-hyperdope-gematria:main"
"technocapital-singularity-zoology:main"
"encyclopedia-knowledge-graph:main"
"ingglish-hyperdope-ci:feat/ingglish-aq-corpus"
)
for entry in "${REPOS[@]}"; do
repo="${entry%%:*}"
branch="${entry##*:}"
if [[ "${TARGET_REPO}" != "all" && "${TARGET_REPO}" != "${repo}" ]]; then
continue
fi
echo "[git.libre.audio -> VPS] Updating ${REPOS_ROOT}/${repo} (${branch})..."
git -C "${REPOS_ROOT}/${repo}" fetch origin "${branch}" --tags
git -C "${REPOS_ROOT}/${repo}" merge --ff-only "origin/${branch}"
done
echo "[audit] Running hs-doctor and 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 "[ram-sync] Syncing per-repo install dirs to ${LIVE_REPOS} and pre-compressing (.br / .gz)..."
for entry in "${REPOS[@]}"; do
repo="${entry%%:*}"
if [[ "${TARGET_REPO}" != "all" && "${TARGET_REPO}" != "${repo}" ]]; then
continue
fi
mkdir -p "${LIVE_REPOS}/${repo}"
rsync -a --delete --exclude='.git' "${REPOS_ROOT}/${repo}/" "${LIVE_REPOS}/${repo}/"
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] Live per-repo install directories updated at ${LIVE_REPOS}"
```