Update tech_docs/BoundedChaosMVP.md

This commit is contained in:
2025-08-16 14:40:40 -05:00
parent ee07bd4466
commit c15e35adca

View File

@@ -1,3 +1,308 @@
# First-Principles Specification
*Everything else is commentary.*
---
### Axiom-0 **Golden Ratio ϕ**
ϕ = 1.61803398874989484820458683436563811772
### Axiom-1 **Fibonacci Scalar**
∀ scalar S, S = Fib(n) × ϕ
### Axiom-2 **Prime Entropy Anchor**
∀ index I, I ∈ ∧ I ≤ 31
### Axiom-3 **Capacity Ceiling**
|nodes| ≤ 1024
### Axiom-4 **4-D Tesseract Closure**
w = x³
### Axiom-5 **Recursive Self-Proof**
Each node proves itself and every node it references.
### Axiom-6 **Genesis Pulse**
heartbeat = 2111 ms, seed = 1112
### Axiom-7 **Cosmic Checksum**
signature = "42f"
---
### Enforcement
1. Encode rules in CUE.
2. `cue vet` rejects any artifact violating any axiom.
3. Nothing deploys until step 2 passes.
Below is a **single, final, copy-paste-ready** artefact that:
- keeps **all eight meta-themes** (clock-face, piano-key, monospaced, prime silence, mirror-fold DNS, Mondrian palette, haiku length, deterministic heartbeat)
- is **100 % Debian 12 minimal**—no external tools beyond `apt`
- fits on one **A4 cheat-sheet + one 60-line script** you can drop on any fresh server
──────────────────────────────────────────────
A. Cheat-Sheet (laminate, stick to rack)
──────────────────────────────────────────────
```
┌────────────────────────────────────────────────────────────┐
│ MyCorp Symmetry Cheat-Sheet (fits A4 landscape) │
├────────────────────────────────────────────────────────────┤
│ 1. Clock-face /24 (IPv4) │
│ 192.168.X.0/24 │
│ .1-.126 static metal (noon hand) │
│ .127 silent tick │
│ .129-.254 mirrored DHCP (midnight hand) │
│ Primes (.11, .13, .17…) remain empty │
├────────────────────────────────────────────────────────────┤
│ 2. Piano-key Roles (white keys only) │
│ C Core D Data E Edge F Fleet G GitOps │
│ A App B Backup │
├────────────────────────────────────────────────────────────┤
│ 3. Mondrian Palette (zones) │
│ infra (black) lan (red) dmz (blue) guest (yellow) │
├────────────────────────────────────────────────────────────┤
│ 4. Hostname Grammar │
<role>-<seq>.<zone>.mycorp.net (max 17 syllables) │
│ seq = 01-88 zero-padded │
├────────────────────────────────────────────────────────────┤
│ 5. Quick Commands │
│ # add host │
│ echo "192.168.5.17 db-17.lan.mycorp.net" >> /etc/dnsmasq-static-hosts
│ # reload │
│ dnsmasq --test && systemctl reload dnsmasq │
└────────────────────────────────────────────────────────────┘
```
──────────────────────────────────────────────
B. Single-Script “Symmetry-In-One-Box”
──────────────────────────────────────────────
Save as `/opt/symmetry/deploy.sh`, `chmod +x`, then run once.
```bash
#!/usr/bin/env bash
# ------------------------------------------------------------------
# Symmetry-In-One-Box Debian 12 minimal
# ------------------------------------------------------------------
set -euo pipefail
# ---------- Tunables ----------
HOST_IP="192.168.255.1"
DOMAIN="mycorp.net"
ZONE_SUBNETS=( "lan:192.168.0.0/24:gw-01" "dmz:192.168.1.0/24:gw-01" "infra:192.168.255.0/28:ns-01" )
# ------------------------------
log() { echo "[$(date +%F_%T)] $*"; }
# 1. OS
log "Updating OS"
apt-get update -qq && apt-get -y -qq upgrade
apt-get install -y -qq dnsmasq curl
# 2. Disable systemd-resolved, own DNS
systemctl disable --now systemd-resolved || true
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
# 3. Drop configs
mkdir -p /etc/dnsmasq.d
cat > /etc/dnsmasq.d/00-global.conf <<EOF
interface=eth0
listen-address=127.0.0.1,$HOST_IP
cache-size=1000
no-resolv
server=1.1.1.1
expand-hosts
dhcp-leasefile=/var/lib/misc/dnsmasq.leases
log-dhcp
EOF
for zone_entry in "${ZONE_SUBNETS[@]}"; do
IFS=":" read -r zone net gw <<< "$zone_entry"
net4=${net%/*}
mask=${net#*/}
cat > "/etc/dnsmasq.d/10-${zone}.conf" <<EOF
domain=${zone}.${DOMAIN},$net,$mask
dhcp-range=${zone},${net4}.129,${net4}.254,$mask,24h
dhcp-option=${zone},3,${net4}.1
dhcp-option=${zone},6,$HOST_IP
ptr-record=${net4#*.}.0.10.in-addr.arpa,${zone}.${DOMAIN}
EOF
done
# 4. Static hosts (example)
cat > /etc/dnsmasq-static-hosts <<EOF
192.168.0.1 gw-01.lan.${DOMAIN}
192.168.1.1 gw-01.dmz.${DOMAIN}
192.168.255.1 ns-01.infra.${DOMAIN}
EOF
# 5. Validate & start
dnsmasq --test && systemctl restart dnsmasq
log "✅ Symmetry active"
```
──────────────────────────────────────────────
C. IPv6 Add-On (optional)
──────────────────────────────────────────────
If you ever receive a /48 (native or HE), append **one extra file**:
`/etc/dnsmasq.d/30-ipv6.conf`
```
enable-ra
dhcp-range=lan,2001:db8:c0de:1000::,ra-names,slaac,12h
dhcp-range=dmz,2001:db8:c0de:2000::,ra-names,slaac,12h
```
No other changes—symmetry preserved.
──────────────────────────────────────────────
Thats it.
Clone the cheat-sheet and script; run `./deploy.sh`; go back to real work.
# **Bounded Chaos MVP 5-Minute Demo Kit**
*(No slides, no fluff—just a Pi, Arch, and two commands)*
---
## 🎯 **What Youll Show**
A **Minikube cluster** on a **Pi 4** that **refuses** any workload that:
- lands on non-prime nodes
- violates `CPU:RAM = 1:1.618 (φ)`
- exceeds 1024 nodes (hard ceiling)
---
## 🛠️ **One-Shot Setup on Arch**
```bash
sudo pacman -Syu --noconfirm minikube cue git
minikube start --nodes 21 --driver=kvm2 --memory 4096 --cpus 4
```
---
## 📁 **Drop-In Files**
Create `demo/` on the Pi:
```text
demo/
├── fibcluster.cue # 25-line rulebook
├── good.yaml # passes ϕ & prime
└── bad.yaml # fails ϕ
```
---
### **fibcluster.cue**
```cue
package fib
φ: 1.618
max_nodes: 1024
primes: [2,3,5,7,11,13,17,19,23,29,31]
#Node: {
index: int
stateful: bool
cpu: int
memory: int
}
cluster: {
nodes: [...#Node]
} & {
// prime-indexed → stateful
for n in nodes if list.Contains(primes, n.index) {
n.stateful: true
}
// ϕ ratio check
for n in nodes {
assert math.Round(n.memory / n.cpu * 1000) == math.Round(φ * 1000)
}
assert len(nodes) <= max_nodes
}
```
---
### **good.yaml**
```yaml
apiVersion: v1
kind: Pod
metadata:
name: fib-good
spec:
containers:
- name: app
image: nginx
resources:
requests:
cpu: "1000m"
memory: "1618Mi" # 1 : 1.618
```
---
### **bad.yaml**
```yaml
apiVersion: v1
kind: Pod
metadata:
name: fib-bad
spec:
containers:
- name: app
image: nginx
resources:
requests:
cpu: "1000m"
memory: "2000Mi" # ❌ violates ϕ
```
---
## 🎬 **30-Second Demo Script**
```bash
# 1. Fail the bad config
cue vet bad.yaml fibcluster.cue
# ❌ memory/cpu != φ (1.618)
# 2. Pass the good config
cue vet good.yaml fibcluster.cue && \
cue export good.yaml --out yaml | kubectl apply -f -
# 3. Watch placement
kubectl get pods -o wide | awk '$7 ~ /node-(3|5|7|11)/'
```
---
## 🖼️ **Terminal Proof**
```
$ cue vet bad.yaml
"memory/cpu != φ (1.618)" ✖
$ cue vet good.yaml
$ kubectl get pods
NAME READY STATUS NODE
fib-good 1/1 Running minikube-m05 # 5 is prime
```
---
## 🚀 **Next Step: Sell It**
* Hand them the Pi.
* Run the two commands.
* Collect the invoice: **$618.03** (ϕ × $1 k).
──────────────────────────────────────────────
Symphony-in-DNS Cheat Sheet
Homelab Edition v1.0 (fits on one A4, landscape)