Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-edge/blob/main/README.md # aien-edge aien-dev/aien-edge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-edge / README.md` 78 lines ยท 5899 bytes Raw Blame History Rendered 1 # aien-edge 2 3 ## Human-Directed Agentic Engineering 4 5 Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, 6 architecture, constraints, acceptance criteria, and stopping points; agents implement, 7 execute checks, diagnose failures, and revise within those boundaries. Human review 8 retains responsibility for claims, acceptance, and release decisions. This describes 9 development, not the server's runtime behavior or deployment status. 10 11 For the documented method and a systems-software case study, see Gregory M. Kurtzer, 12 [*Ginux: Building an Independent Kernel That Runs Linux Userspace through 13 Human-Directed Agentic Engineering* (2026)](https://doi.org/10.5281/zenodo.`23682548`). 14 15 16 A small native Rust web server for the AIEN static sites (`www.aienos.com`, `www.drakestapleton.com`). It was built to run on a Raspberry Pi at the network edge so the NVIDIA DGX Spark never faces the internet. 17 18 Supports [Sovereign Intelligence (SI)](https://github.com/aien-dev/sovereign-intelligence). SI's Every repository index lists this server under Apps, tools and the front door. This is hosting infrastructure, not the integration, release and install center. 19 20 **Status (2026-10-18): not in use.** Both sites are served by GitHub Pages today (their DNS records point at `aien-dev.github.io`), so this server is not serving either of them. The code was written on 2026-09-23. Changes since then are a relicense (2026-10-04), a README correction (2026-10-13) and a security update of the TLS library (2026-10-17). The publish script still builds sites with `npm`, which no longer matches how either site is built (both use Rust generators now), so it would need updating before any redeploy. 21 22 ## What it does 23 24 - **Everything in memory.** Each site is read once at startup (and again on reload). Text-like files of 1 KiB or more are precompressed with brotli (quality 11) and gzip, and every file is hashed for ETags. Requests never touch the disk. 25 - **Automatic HTTPS.** Let's Encrypt certificates through `rustls-acme` (TLS-ALPN-01 on port 443; port 80 only redirects), HTTP/2 and HTTP/1.1. TLS is `rustls`; nothing is hand-rolled. Without a `[tls]` table in the config the server runs plain HTTP only and serves content on the HTTP port (local testing). 26 - **Virtual hosts.** Canonical host per site, apex to `www` 301 redirects, HTTP to HTTPS redirects, 421 for unknown hosts. 27 - **Small attack surface.** GET and HEAD only, traversal-safe path normalization against an in-memory map (no filesystem lookups per request), hidden files and source maps never loaded, header-read and TLS-handshake timeouts, a connection cap, and security headers (HSTS, nosniff, frame denial, referrer policy). 28 - **Zero-downtime deploys.** `SIGHUP` (`systemctl reload aien-edge`) reloads every site's files; if the new copy fails to load, the old one keeps serving. The config file is read only at startup, so config changes need a restart. 29 30 ## Measured 31 32 On the Spark (aarch64), serving both built sites from one process, HTTP/1.1 keep-alive, brotli, against a page that returns 200 (`/research`, 6036 bytes brotli). Three runs on commit `59df18c`, recorded in the message of commit `843cc77`. The built sites are not in this repo, so the run cannot be repeated from here alone: 33 34 ``` 35 $ ab -k -n 50000 -c 64 -H "Host: www.drakestapleton.com" -H "Accept-Encoding: br" http://127.0.0.1:18777/research 36 Document Length: 6036 bytes 37 Complete requests: 50000 38 Failed requests: 0 39 Requests per second: 208785.70 / 192780.75 / 196101.50 [#/sec] (mean) 40 Time per request: 0.307 / 0.332 / 0.326 [ms] (mean) 41 VmRSS: 18316 kB (VmHWM 35924 kB) 42 ``` 43 44 `ab` counts only dropped connections as failed. Check that the output has no `Non-2xx responses` line, or the run measured an error page. 45 46 Not measured on a Pi. 47 48 ## Build and test 49 50 Needs Rust 1.88 or newer (`rust-version` in `Cargo.toml`). `rust-toolchain.toml` pins 1.88.0, so rustup uses that release in this directory. The `msrv` workflow builds, tests and lints on it with `--locked` for every pull request. 51 52 ```bash 53 cargo test 54 cargo clippy --release -- -D warnings 55 cargo build --release # target/release/aien-edge, aarch64 builds run on a 64-bit Pi OS 56 ``` 57 58 ## Deploy on the Pi 59 60 ```bash 61 sudo install -m 0755 target/release/aien-edge /usr/local/bin/aien-edge 62 sudo install -D -m 0644 deploy/config.example.toml /etc/aien-edge/config.toml 63 sudo install -m 0644 deploy/aien-edge.service /etc/systemd/system/aien-edge.service 64 sudo mkdir -p /srv/sites/releases 65 sudo systemctl daemon-reload && sudo systemctl enable --now aien-edge 66 ``` 67 68 The server exits at startup if a site root is missing or has no `index.html`, and `Restart=always` retries every 2 seconds, so publish the sites soon after the first start. Publish each site from the Spark with `deploy/publish-site.sh `: it runs `npm ci` and `npm run build` in the checkout (see the status note above: the sites no longer build with npm), uploads `dist/` to `/srv/sites/releases/` on the Pi (set `EDGE_HOST` to the Pi's ssh address), repoints `/srv/sites/` and reloads, keeping the last three releases. Keep `production = false` (Let's Encrypt staging) until the certificates issue, then switch to `true` and restart (a reload does not re-read the config). 69 70 Network: forward TCP 80 and 443 on the router to the Pi only, and point the DNS A records for both apex and `www` hosts at the public IP. The Spark reaches the Pi (over ssh and rsync, on the direct link) only to deploy; aien-edge itself never connects to the Spark. 71 72 ## License 73 74 Licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later). See [LICENSE](LICENSE). Values live in the nonbinding [COVENANT.md](COVENANT.md). 75 76 ## Copyright 77 78 Copyright (c) 2026 Drake Stapleton and AIEN Contributors. Authored by Drake Stapleton in collaboration with AIEN.