Skip to content

Commit 5df1e5f

Browse files
mios-devclaude
andcommitted
docs(arch,eng): compact upstream research; expand FHS/bootc layout; fix AI refs
- ARCHITECTURE.md: add uCore HCI base image section (CoreOS foundation, LTS 6.12 kernel, pre-signed NVIDIA akmods, libvirt/KVM, ZFS, SELinux); expand FHS table with bootc disposition column + /run and /home rows; add bootc 3-way merge explanation for /etc; fix AI surface table to reference MIOS_AI_ENDPOINT; document OpenAI v1 API endpoints, streaming SSE, tool calling; fix bootc and uCore upstream URLs in references. - ENGINEERING.md: add upstream bootc constraints section documenting what bootc container lint enforces and the kargs.d flat-array-only rule. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5e91f5b commit 5df1e5f

2 files changed

Lines changed: 58 additions & 10 deletions

File tree

ARCHITECTURE.md

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,43 @@
1414
USBGuard, CrowdSec sovereign-mode IPS, kernel-lockdown integrity. See
1515
`SECURITY.md`.
1616

17+
## Base image — uCore HCI
18+
19+
MiOS builds `FROM ghcr.io/ublue-os/ucore-hci:stable-nvidia` (`MIOS_BASE_IMAGE`).
20+
uCore HCI is a Universal Blue derivative of Fedora CoreOS targeting
21+
hyperconverged infrastructure:
22+
23+
| Layer | What it provides |
24+
|---|---|
25+
| Fedora CoreOS foundation | Immutable ostree rootfs, composefs `/usr`, SELinux enforcing, podman, ZFS kernel modules |
26+
| uCore additions | cockpit, firewalld, tailscale, mergerfs, samba, NFS |
27+
| HCI additions | libvirt/KVM, QEMU, VFIO-PCI tooling, virtiofs |
28+
| NVIDIA variant (`stable-nvidia`) | Proprietary driver akmods pre-built and MOK-signed; NVIDIA Container Toolkit |
29+
| Stable stream kernel | LTS Linux 6.12 — server-grade stability, consistent ABI across updates |
30+
31+
MiOS adds: GNOME 50 desktop, Looking Glass B7, KVM passthrough, k3s, Ceph,
32+
full AI surface, and defense-in-depth hardening on top.
33+
34+
Upstream: <https://github.com/ublue-os/ucore>
35+
1736
## Filesystem layout (FHS 3.0 + bootc)
1837

1938
Spec: <https://refspecs.linuxfoundation.org/FHS_3.0/>.
2039

21-
| Path | Type | Source-of-truth in repo |
22-
|---|---|---|
23-
| `/usr` | Immutable image content | `usr/` (overlaid by `automation/08-system-files-overlay.sh`) |
24-
| `/etc` | Persistent admin-override surface; build-time writes are upstream-contract only | `etc/` |
25-
| `/var` | Persistent state; declared via `tmpfiles.d` | `usr/lib/tmpfiles.d/mios*.conf` |
26-
| `/srv` | Sidecar service data (models, databases) | `srv/`, `usr/lib/tmpfiles.d/mios.conf` |
40+
bootc disposition reflects FHS 3.0's intent: `/usr` is explicitly
41+
"shareable, read-only" in the spec — the composefs/ostree model enforces this
42+
at the kernel level. `/etc` is the host-specific config surface; bootc applies
43+
a 3-way merge (image default + previous state + admin edits) on upgrade so
44+
local changes survive. `/var` is never touched by an upgrade.
45+
46+
| Path | FHS character | bootc disposition | Source-of-truth in repo |
47+
|---|---|---|---|
48+
| `/usr` | Read-only, shareable | Immutable composefs mount; change = new OCI image | `usr/` overlaid by `automation/08-system-files-overlay.sh` |
49+
| `/etc` | Host-specific config | 3-way merge overlay; admin edits survive upgrades | `etc/` |
50+
| `/var` | Mutable, persistent | Fully writable; never replaced on upgrade | `usr/lib/tmpfiles.d/mios*.conf` (LAW 2) |
51+
| `/srv` | Data served by the system | Persistent; AI model weights, Ceph data | `usr/lib/tmpfiles.d/mios.conf` |
52+
| `/run` | Ephemeral runtime (FHS 3.0) | tmpfs; cleared at boot; never in image layers ||
53+
| `/home` | User home directories | Persistent via `/var/home/<user>` + symlink | `usr/lib/sysusers.d/` |
2754

2855
Build-time writes to `/var/` are forbidden (LAW 2). The overlay step at
2956
`automation/08-system-files-overlay.sh:49-67` writes home dotfiles to
@@ -43,17 +70,23 @@ in-image (`automation/53-bake-lookingglass-client.sh`).
4370

4471
## AI surface
4572

73+
All agents and tooling target `MIOS_AI_ENDPOINT` (`http://localhost:8080/v1`).
74+
The endpoint implements the OpenAI v1 REST protocol — core surfaces:
75+
`GET /v1/models`, `POST /v1/chat/completions` (streaming SSE supported),
76+
`POST /v1/embeddings`. Auth: `Authorization: Bearer $MIOS_AI_KEY` (empty key
77+
accepted by the local stack). Tool calling (`tools` array,
78+
`finish_reason: tool_calls`) is supported for capable models.
79+
4680
| Service | Protocol | Path |
4781
|---|---|---|
48-
| Inference | OpenAI-compatible REST | `http://localhost:8080/v1` (LocalAI Quadlet `etc/containers/systemd/mios-ai.container`) |
82+
| Inference | OpenAI v1 REST | `MIOS_AI_ENDPOINT` (`http://localhost:8080/v1`) — Quadlet `etc/containers/systemd/mios-ai.container` |
4983
| Discovery | MCP | `usr/share/mios/ai/v1/mcp.json` |
5084
| Metadata | JSON | `usr/share/mios/ai/v1/models.json` |
5185
| System prompt | markdown | `usr/share/mios/ai/system.md` (canonical), `etc/mios/ai/system-prompt.md` (host override) |
5286

5387
References:
54-
- bootc: <https://github.com/containers/bootc>
88+
- bootc: <https://github.com/bootc-dev/bootc>
5589
- bootc-image-builder: <https://github.com/osbuild/bootc-image-builder>
56-
- Universal Blue (uCore base): <https://github.com/ublue-os/main>
90+
- Universal Blue uCore HCI: <https://github.com/ublue-os/ucore>
5791
- rechunk: <https://github.com/hhd-dev/rechunk>
5892
- cosign: <https://github.com/sigstore/cosign>
59-
- LocalAI: <https://github.com/mudler/LocalAI>

ENGINEERING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ fcontexts are declared via `semanage` calls in `automation/37-selinux.sh`.
9595
`/var/lib/mios/memory/journal/` via `usr/lib/tmpfiles.d/mios.conf`.
9696
- Declarative state: `tmpfiles.d` and `sysusers.d` only.
9797

98+
## Upstream base image constraints (bootc)
99+
100+
`bootc container lint` (LAW 4) enforces at build time:
101+
- Kernel present and detectable at `/usr/lib/modules/<kver>/vmlinuz`
102+
- No files written under `/var` or `/run` in image layers — these are
103+
runtime-mutable and never part of the composefs rootfs
104+
- `/usr` structurally valid (no dangling symlinks, no unexpected setuid files)
105+
- OCI config has `architecture` and `os` fields set
106+
- `systemd` must be PID 1 (init at `/sbin/init`)
107+
108+
kargs.d constraint (also enforced by lint): flat `kargs = [...]` TOML array
109+
only. No `[kargs]` section header, no `delete` sub-key. Files processed in
110+
lexicographic order; earlier entries cannot be removed by later files in the
111+
same image — use runtime `bootc kargs --delete` for removal.
112+
98113
## Toolchain
99114

100115
| Tool | Use |

0 commit comments

Comments
 (0)