Skip to content

Commit 608bfd9

Browse files
mios-devclaude
andcommitted
AUDIT: enforce all 6 architectural laws + refine docs to purely referential form
Architectural-law fixes (INDEX.md §3): - LAW 1 USR-OVER-ETC: relocate nvidia-container-toolkit cdi-refresh.env to tmpfiles.d (create-if-missing); document /etc/yum.repos.d and CrowdSec config as upstream-contract surfaces. - LAW 2 NO-MKDIR-IN-VAR: consolidate /etc/cdi, /var/run/cdi, /var/lib/mios/gpu into usr/lib/tmpfiles.d/mios-gpu.conf; strip redundant ExecStartPre install -d /var/run/cdi from mios-gpu-{nvidia,amd,intel,status}.service. - LAW 3 BOUND-IMAGES: extend automation/08-system-files-overlay.sh binder loop to walk /etc/containers/systemd/ in addition to /usr/share; remove stale mios-{guacamole,pxe-hub} symlinks; add cloudws-{guacamole,pxe-hub} and mios-{ai,ceph,k3s} bound-images entries. - LAW 4 BOOTC-CONTAINER-LINT: split bootc container lint from ostree container commit so lint is the literal final RUN of Containerfile. - LAW 6 UNPRIVILEGED-QUADLETS: declare User=/Group=/Delegate=yes on the six cloudws/usr-share Quadlets with new sysusers entries (usr/lib/sysusers.d/50-mios-services.conf); declare User=root/Group=root explicitly on mios-ceph and mios-k3s as documented exceptions. Build-pipeline fixes: - Containerfile: COPY --from=ctx replaced with read-only bind-mount; security stack moved into a new packages-base block invoked via install_packages_strict. - PACKAGES.md: drop bare 'kernel' (replaced with 'kernel-core' for validation); add packages-base, packages-moby, packages-uki, packages-sbom-tools, packages-k3s-selinux-build blocks. - Phase scripts 19/21/23/90 refactored from naked dnf install to install_packages helpers (PACKAGES.md SSOT). - automation/01-repos.sh: GPG-key install no longer swallows failure with 2>/dev/null; drop --best from F44 pre-upgrade. CI workflow: - .github/workflows/mios-ci.yml: read VERSION from file (no drift); rechunk job gated on refs/tags/v* before push; cosign sign gated on tags only. Justfile: - Add 'lint' recipe so the CONTRIBUTING.md reference is no longer dead. Repo hygiene: - Delete tracked stray archives (mios-legacy.tar 13MB, FOUND-THE-FILES.tar, files.zip, files1.zip), generated artifacts (root-manifest.json, MiOS-SBOM.csv) and transient audit reports (AUDIT-FINDINGS-*, WORKFLOW-AUDIT-*). - .gitignore: drop the corresponding stale whitelist negations; fix the /workspaces/MiOS path comment. - Regenerate automation/manifest.json, tools/manifest.json, agents/research/manifest.json from current source via tools/generate-ai-manifest.py (in-tree snapshots were 2026-04-29-stale). Documentation refinement (purely technical + referential, sourced): - README, INDEX, ARCHITECTURE, ENGINEERING, SECURITY, SELF-BUILD, DEPLOY, CONTRIBUTING, LICENSES rewritten with file:line citations and upstream spec links (kernel admin-guide, FHS 3.0, bootc, BIB, rechunk, cosign, LocalAI, OpenAI API). - DEPLOY.md heavy rewrite: previous version referenced a 'mios' build-CLI that does not exist (usr/bin/mios is the OpenAI chat client). - SELF-BUILD.md: drop duplicate 'Future Considerations: image-builder-cli' section; drop '[NET] MiOS Artifact / Proprietor' preamble. - MiOS-Engineering-Reference.md: remove 'Memory caveat' rows and the 'Reconciliation with prior project memory' appendix (conversational metadata) — kept the technical content. - CLAUDE.md: align the build.sh shell-flag claim with code reality (set -euo pipefail with set +e/-e toggled around per-script invocation at automation/build.sh:234-237). - Delete SUMMARY.md (transient session log). 54 files changed, 1241 insertions, 3142 deletions. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent d5c1535 commit 608bfd9

54 files changed

Lines changed: 1241 additions & 3142 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/mios-ci.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
- name: Checkout
2727
uses: actions/checkout@v4
2828

29+
- name: Read VERSION
30+
id: ver
31+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
32+
2933
- name: Set up QEMU
3034
uses: docker/setup-qemu-action@v3
3135

@@ -47,7 +51,7 @@ jobs:
4751
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4852
tags: |
4953
type=raw,value=latest,enable={{is_default_branch}}
50-
type=raw,value=v0.2.0,enable={{is_default_branch}}
54+
type=raw,value=${{ steps.ver.outputs.version }},enable={{is_default_branch}}
5155
type=ref,event=branch
5256
type=ref,event=pr
5357
type=semver,pattern={{version}}
@@ -64,12 +68,38 @@ jobs:
6468
provenance: true
6569
sbom: true
6670

71+
# Rechunking produces 5-10x smaller Day-2 deltas (Justfile:rechunk).
72+
# Only worth the cost on tag pushes; branch builds skip it.
73+
- name: Install podman
74+
if: startsWith(github.ref, 'refs/tags/v')
75+
run: |
76+
sudo apt-get update -qq
77+
sudo apt-get install -y podman
78+
79+
- name: Rechunk on tag
80+
if: startsWith(github.ref, 'refs/tags/v')
81+
env:
82+
IMAGE_TAG: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.ver.outputs.version }}
83+
run: |
84+
podman pull "${IMAGE_TAG}"
85+
podman run --rm \
86+
--security-opt label=type:unconfined_t \
87+
-v /var/lib/containers/storage:/var/lib/containers/storage \
88+
"${IMAGE_TAG}" \
89+
/usr/libexec/bootc-base-imagectl rechunk --max-layers 67 \
90+
"containers-storage:${IMAGE_TAG}" \
91+
"containers-storage:${IMAGE_TAG}-rechunked"
92+
podman tag "${IMAGE_TAG}-rechunked" "${IMAGE_TAG}"
93+
podman tag "${IMAGE_TAG}" "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
94+
podman push "${IMAGE_TAG}"
95+
podman push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
96+
6797
- name: Install cosign
68-
if: github.event_name != 'pull_request'
98+
if: startsWith(github.ref, 'refs/tags/v')
6999
uses: sigstore/cosign-installer@v3
70100

71101
- name: Cosign keyless sign
72-
if: github.event_name != 'pull_request'
102+
if: startsWith(github.ref, 'refs/tags/v')
73103
env:
74104
COSIGN_EXPERIMENTAL: '1'
75105
run: |
@@ -90,6 +120,6 @@ jobs:
90120
sudo apt-get update -qq
91121
sudo apt-get install -y podman
92122
93-
- name: Build for smoke test
123+
- name: Smoke build (lint via Containerfile final RUN)
94124
run: |
95125
podman build -t mios:smoke -f Containerfile .

.gitignore

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# then the parent's contents must be re-ignored before the child is unignored.
66
#
77
# IMPORTANT: /.gitignore must be a real file (not a symlink) because git opens it
8-
# with O_NOFOLLOW. After editing this file run:
9-
# sudo cp /workspaces/MiOS/.gitignore /.gitignore
8+
# with O_NOFOLLOW. After editing this file at the repo root, run:
9+
# sudo cp ./.gitignore /.gitignore
1010

1111
# ─────────────────────────────────────────────────────────────────────────────
1212
# 1. BLOCK EVERYTHING
@@ -36,15 +36,10 @@
3636
!/LICENSES.md
3737
!/README.md
3838
!/SECURITY.md
39-
!/AUDIT-FINDINGS-*.md
40-
!/WORKFLOW-AUDIT-*.md
4139
!/SELF-BUILD.md
42-
!/SUMMARY.md
4340
!/VERSION
4441
!/llms-full.txt
4542
!/llms.txt
46-
!/root-manifest.json
47-
!/MiOS-SBOM.csv
4843
!/MiOS-Engineering-Reference.md
4944
!/image-versions.yml
5045
!/install.sh

ARCHITECTURE.md

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,59 @@
1-
# MiOS ARCHITECTURE — System Blueprint (Day 0)
2-
3-
```json:knowledge
4-
{
5-
"summary": "Consolidated architectural specification for MiOS. Hardware, Filesystem, and AI Interface SSOT.",
6-
"logic_type": "blueprint",
7-
"tags": ["MiOS", "Architecture", "Day-0", "SSOT"],
8-
"version": "v0.2.0"
9-
}
10-
```
11-
12-
## 🏗️ Core Pillars
13-
MiOS is a container-native workstation engineered for high-performance virtualization and local Generative AI development.
14-
15-
1. **Transactional Integrity**: The system core is cryptographically sealed and managed via `bootc`.
16-
2. **Hardware Agnosticism**: Universal acceleration for primary GPU vendors (NVIDIA, AMD, Intel).
17-
3. **Zero-Trust Boundary**: Mandatory execution control and kernel-level isolation.
18-
19-
---
20-
21-
## 💾 Filesystem Hierarchy (FHS 3.0 + bootc)
22-
MiOS mirrors the standard Linux FHS within its OCI root.
23-
24-
| Path | Type | Intent |
25-
| :--- | :--- | :--- |
26-
| `/usr` | Immutable | System Binaries, Libraries, and Static Config. |
27-
| `/etc` | Persistent | Host-specific overrides. |
28-
| `/var` | Persistent | System state and User home directories. |
29-
| `/srv` | Persistent | Sidecar service data (Models, Databases). |
30-
31-
### ⚖️ Immutability Mandate
32-
Build-time overlays into `/var` are architectural violations. All `/var` state must be declared via `tmpfiles.d` to ensure atomic, reproducible deployments.
33-
34-
---
35-
36-
## 🖥️ Hardware Delegation
37-
38-
### 🎮 Universal Acceleration
39-
Standardized CDI (Container Device Interface) and ROCm/Arc drivers ensure local AI tools access native hardware performance.
40-
- **Hardware Targeting**: Primary GPU IDs `10de:2204,10de:1aef`.
41-
42-
### ⚡ Virtualization
43-
Tier-1 Hypervisor capabilities (KVM/QEMU) are native to the system core, supporting VFIO-PCI passthrough and shared memory (KVMFR) buffers.
44-
45-
---
46-
47-
## 🤖 AI Interface Surface
48-
The system architecture exposes a local OpenAI-compatible API surface for autonomous management and user interaction.
49-
50-
| Service | Protocol | Access Point |
51-
| :--- | :--- | :--- |
52-
| **Inference** | REST | `http://localhost:8080/v1` |
53-
| **Discovery** | MCP | `/usr/share/mios/ai/mcp/` |
54-
| **Metadata** | JSON | `/usr/share/mios/ai/v1/` |
55-
56-
---
57-
*Copyright (c) 2026 MiOS. Pure FOSS. Zero Day Ready.*
1+
# MiOS Architecture
2+
3+
## Pillars
4+
5+
1. **Transactional integrity** — system core is a content-addressed OCI image
6+
managed by `bootc` (<https://bootc-dev.github.io/bootc/>). Atomic upgrade
7+
and rollback via `bootc upgrade` / `bootc rollback`.
8+
2. **Hardware acceleration** — universal CDI (Container Device Interface,
9+
<https://github.com/cncf-tags/container-device-interface>) for NVIDIA,
10+
AMD ROCm/KFD, and Intel iGPU. CDI specs generated under `/var/run/cdi/`,
11+
admin overrides under `/etc/cdi/` (declared in
12+
`usr/lib/tmpfiles.d/mios-gpu.conf`).
13+
3. **Zero-trust execution**`fapolicyd` deny-by-default, SELinux enforcing,
14+
USBGuard, CrowdSec sovereign-mode IPS, kernel-lockdown integrity. See
15+
`SECURITY.md`.
16+
17+
## Filesystem layout (FHS 3.0 + bootc)
18+
19+
Spec: <https://refspecs.linuxfoundation.org/FHS_3.0/>.
20+
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` |
27+
28+
Build-time writes to `/var/` are forbidden (LAW 2). The overlay step at
29+
`automation/08-system-files-overlay.sh:49-67` writes home dotfiles to
30+
`/etc/skel/` and lets `systemd-sysusers` populate `/var/home/<user>/` at
31+
first boot.
32+
33+
## Hardware delegation
34+
35+
Default GPU passthrough targets (`ARCHITECTURE.md` previously hard-coded
36+
`10de:2204,10de:1aef`; current behavior detects at runtime via
37+
`automation/34-gpu-detect.sh` and writes `/run/mios/gpu-passthrough.status`).
38+
39+
Virtualization: KVM/QEMU + libvirt (`automation/12-virt.sh`), VFIO-PCI
40+
passthrough kargs (`usr/lib/bootc/kargs.d/`), KVMFR shared-memory built
41+
in-image (`automation/52-bake-kvmfr.sh`), Looking Glass B7 client built
42+
in-image (`automation/53-bake-lookingglass-client.sh`).
43+
44+
## AI surface
45+
46+
| Service | Protocol | Path |
47+
|---|---|---|
48+
| Inference | OpenAI-compatible REST | `http://localhost:8080/v1` (LocalAI Quadlet `etc/containers/systemd/mios-ai.container`) |
49+
| Discovery | MCP | `usr/share/mios/ai/v1/mcp.json` |
50+
| Metadata | JSON | `usr/share/mios/ai/v1/models.json` |
51+
| System prompt | markdown | `usr/share/mios/ai/system.md` (canonical), `etc/mios/ai/system-prompt.md` (host override) |
52+
53+
References:
54+
- bootc: <https://github.com/containers/bootc>
55+
- bootc-image-builder: <https://github.com/osbuild/bootc-image-builder>
56+
- Universal Blue (uCore base): <https://github.com/ublue-os/main>
57+
- rechunk: <https://github.com/hhd-dev/rechunk>
58+
- cosign: <https://github.com/sigstore/cosign>
59+
- LocalAI: <https://github.com/mudler/LocalAI>

0 commit comments

Comments
 (0)