diff --git a/.fabrica/app.yaml b/.fabrica/app.yaml index 1071433..4465de6 100644 --- a/.fabrica/app.yaml +++ b/.fabrica/app.yaml @@ -1,10 +1,14 @@ -# Ianitor Domi declares itself to Fabrica (Fabrica core docs/FORMATS.md, "Fabrica: the app"): a server part only, -# the reverse proxy with its control plane and web UI, deployed by .fabrica/artifex/deploy.yaml through the server's -# fabrica-deploy@ianitor. Fabrica's Apps screen shows one card for it: Deploy, then the Custos card. The colour is -# the murex accent (packages/ui/src/tokens.css, --accent). +# Ianitor Domi declares itself to Fabrica (Fabrica core docs/FORMATS.md, "Fabrica: the app"; docs/fabrica.md): a server +# part only, the reverse proxy with its control plane and web UI, deployed by .fabrica/artifex/deploy.yaml through the +# server's fabrica-deploy@ianitor, which is also how it updates. Its Aula page comes from the release of a `v*` tag +# (.fabrica/artifex/release.yaml), started on the hub for the pushed tag: no desktop part, as Ianitor has no installer +# to bump and tag. Fabrica's Apps screen shows one card: Deploy, then the Custos card. The colour is the murex accent +# (packages/ui/src/tokens.css, --accent). name: Ianitor icon: globe color: "#e0a3dc" +aula: true +tagPrefix: v parts: server: pipeline: deploy diff --git a/.fabrica/artifex/e2e.yaml b/.fabrica/artifex/e2e.yaml new file mode 100644 index 0000000..baefe94 --- /dev/null +++ b/.fabrica/artifex/e2e.yaml @@ -0,0 +1,15 @@ +# Ianitor Domi: the web UI's e2e suite on Fabrica's e2e runner (docs/fabrica.md part 6; Fabrica docs/20_tests.md, +# docs/31_runners_here.md): the built UI against the demo control plane, Playwright headless in the installed Edge, +# the records, traces and videos kept with the run. Manual: no push webhook reaches the hub yet. The e2e runner's +# runner.json sets PLAYWRIGHT_BROWSERS_PATH (Playwright's ffmpeg for the videos; on D: or F:, never C:). +name: e2e +on: + manual: true +runner: windows-e2e +steps: + - id: install + run: pnpm install --frozen-lockfile + - id: web + needs: [install] + run: fabrica tests run --target web + artifacts: [".fabrica/runs/tests/**"] diff --git a/.fabrica/artifex/release.yaml b/.fabrica/artifex/release.yaml index e05263b..1fcd83a 100644 --- a/.fabrica/artifex/release.yaml +++ b/.fabrica/artifex/release.yaml @@ -1,11 +1,13 @@ -# Ianitor Domi: the Gitea release of a v* tag (docs/release.md). Ianitor ships no binary (the server builds it with -# Nix and the deploy pipeline switches it in), so a release is its notes and screenshots of the web UI, published under -# a SHA256SUMS signed by domi-release through Custos; release-notes.md is also the release's text on Gitea. +# Ianitor Domi: the Gitea release of a v* tag (docs/release.md, docs/fabrica.md). Ianitor ships no binary (the server +# builds it with Nix and the deploy pipeline switches it in), so a release is the source archive of the tag, its notes, +# the screenshots of the web UI and the Aula page, all under a SHA256SUMS signed by domi-release through Custos; +# release-notes.md is also the release's text on Gitea. # The Windows runner (the Fabrica app on Mark's PC) runs it: `fabrica`, node and pnpm are on every step's PATH. # No Gitea webhook to the hub yet: a pushed tag is started on demand (the hub's POST /api/runs, ref v). -# `notes` is Fabrica's release notes since the previous v* tag (Fabrica docs/12_release_kit.md); `shots` takes the -# same files as `fabrica aula shots` (core docs/FORMATS.md, "Fabrica: the Aula page") from the built web UI against -# the demo control plane with invented data, in headless Edge. No landing page while app.yaml has no `aula: true`. +# The web UI's e2e suite (apps/web/playwright.config.ts) runs the main flows and takes the pictures in the installed +# Edge against the demo control plane with invented data, at a fixed instant; `fabrica aula shots` checks and copies +# them (.fabrica/aula.yaml, `file:` shots) and `fabrica aula page` builds the landing page from them and the brief. +# Playwright's ffmpeg (videos) is in the runner's PLAYWRIGHT_BROWSERS_PATH, never on C:; nothing is downloaded. name: release on: tag: "v*" @@ -22,23 +24,39 @@ steps: - id: test needs: [install] run: pnpm --filter web test + - id: e2e + needs: [check, test] + run: pnpm --filter web test:e2e + - id: pictures + needs: [e2e] + run: pnpm --filter web aula:shots + - id: source + needs: [version] + run: node scripts/pack-source.mjs ${{ version }} + artifacts: ["target/release/ianitor-*-src.tar.gz"] - id: notes run: fabrica notes artifacts: ["target/notes/release-notes.md", "target/notes/release-notes.json"] - id: shots - needs: [check, test] - run: node apps/web/scripts/shots.mjs + needs: [pictures] + run: fabrica aula shots artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"] + - id: page + needs: [notes, shots] + run: fabrica aula page + artifacts: ["target/aula/aula-page.json", "target/aula/aula-page.html"] - id: approve - needs: [version, notes, shots] - approve: "Publish Ianitor ${{ tag }}: its notes and screenshots?" + needs: [source, page] + approve: "Publish Ianitor ${{ tag }}: its source, notes and screenshots?" - id: publish needs: [approve] publish: gitea-release: true files: + - "**/ianitor-*-src.tar.gz" - "**/release-notes.md" - "**/release-notes.json" - "**/aula-*.png" - "**/aula.json" + - "**/aula-page.json" sums: domi-release diff --git a/.fabrica/aula.yaml b/.fabrica/aula.yaml new file mode 100644 index 0000000..4f87154 --- /dev/null +++ b/.fabrica/aula.yaml @@ -0,0 +1,26 @@ +# Ianitor Domi's Aula page (docs/fabrica.md part 2, part 5; Fabrica docs/09_aula_pages.md, docs/19_web_shots.md). +# Every picture is taken by the web UI's own e2e suite (`pnpm --filter web aula:shots`, apps/web/e2e/specs/aula.spec.ts): +# the built UI in Edge against the demo control plane (apps/web/tests/demo.ts: hostnames under .test, addresses in the +# documentation ranges, people ada and felix), 1440 x 900, at a fixed instant in Europe/Prague. `fabrica aula shots` +# checks each file and publishes it as aula-.png with aula.json; it starts no browser of its own. +shots: + - name: hosts + title: Every host, its health and where it sends traffic + section: Hosts + file: target/e2e/aula/hosts.png + - name: host + title: Editing a host + section: Hosts + file: target/e2e/aula/host.png + - name: engine + title: Pingora serving, Caddy ready as the fallback + section: Engines + file: target/e2e/aula/engine.png + - name: history + title: "History: going back to a kept version" + section: Changes + file: target/e2e/aula/history.png + - name: certificates + title: The Domi CA and the device certificates + section: Certificates + file: target/e2e/aula/certificates.png diff --git a/.fabrica/aula/brief.md b/.fabrica/aula/brief.md new file mode 100644 index 0000000..6327b5f --- /dev/null +++ b/.fabrica/aula/brief.md @@ -0,0 +1,9 @@ +A reverse proxy for a home server where every change is tried, watched and undone if it fails. + +Each host says in plain words where its traffic goes, which certificate it uses and whether visitors sign in first. A change is checked, tried and watched for a minute, and goes back on its own if a host stops answering. Pingora serves, Caddy stands by built from the same routes, and a small Domi certificate authority issues the certificates for home-only hosts and devices. + +- hosts: Every host with its health, its certificate and where it sends traffic. +- host: A host in plain words: upstreams, certificate, sign-in and health check. +- engine: Pingora serving, with Caddy built from the same routes and compared host by host. +- history: Every kept version in history, and exactly what restoring one would change. +- certificates: The Domi intermediate and the device certificates for phones, laptops and apps. diff --git a/.fabrica/pensum/j4yav1-turn-on-the-visual-gate-against-v0-2-0.md b/.fabrica/pensum/j4yav1-turn-on-the-visual-gate-against-v0-2-0.md new file mode 100644 index 0000000..1018b66 --- /dev/null +++ b/.fabrica/pensum/j4yav1-turn-on-the-visual-gate-against-v0-2-0.md @@ -0,0 +1,15 @@ +--- +id: j4yav1 +title: Turn on the visual gate against v0.2.0 +status: todo +priority: normal +labels: [fabrica, release] +created: 2026-11-19T01:25:43+01:00 +updated: 2026-11-19T01:25:43+01:00 +doc: docs/fabrica.md +--- +Add Fabrica's visual step (docs/28_visual.md part 6) to .fabrica/artifex/release.yaml after shots: fabrica visual compare --shots target/aula --out target/visual --before ${{ tag }} --forge https://gitea.marek-novak.cz/mnovak/ianitor, custos: [gitea-token], and approve needs visual. Waits one release because v0.1.0's shots were taken at a moving clock, so every shot would differ (docs/fabrica.md part 5). + +## Log + +- 2026-11-19T01:25:43+01:00 mnovak: created diff --git a/.fabrica/pensum/jd3x1h-publish-the-showcase-videos-on-aula.md b/.fabrica/pensum/jd3x1h-publish-the-showcase-videos-on-aula.md new file mode 100644 index 0000000..5520d60 --- /dev/null +++ b/.fabrica/pensum/jd3x1h-publish-the-showcase-videos-on-aula.md @@ -0,0 +1,15 @@ +--- +id: jd3x1h +title: Publish the showcase videos on Aula +status: todo +priority: normal +labels: [fabrica, aula] +created: 2026-11-19T01:25:17+01:00 +updated: 2026-11-19T01:25:17+01:00 +doc: docs/fabrica.md +--- +The e2e suite records each main flow as target/e2e/videos/.webm (docs/fabrica.md part 5). Once Fabrica's docs/37 (aula.yaml `videos:`) is on Fabrica main, list them in .fabrica/aula.yaml, add **/aula-*.webm to the release's publish files and to Aula's entry if needed, and check the limits (WebM, at most 8 MiB and 60 s each, at most 6). + +## Log + +- 2026-11-19T01:25:17+01:00 mnovak: created diff --git a/.fabrica/tests.yaml b/.fabrica/tests.yaml new file mode 100644 index 0000000..64c5fa2 --- /dev/null +++ b/.fabrica/tests.yaml @@ -0,0 +1,11 @@ +# Ianitor Domi's Playwright tests (docs/fabrica.md part 6; Fabrica docs/20_tests.md): the web UI's main flows on the +# built UI and the demo control plane (apps/web/playwright.config.ts, project `web`), each recorded as a video. +# `fabrica tests run`, or Tests in the Fabrica app; the e2e pipeline (.fabrica/artifex/e2e.yaml) runs the same target +# on the e2e runner. No android target: Ianitor has no Android build. The Rust suites run in WSL2 and the Nix build. +dir: apps/web +gate: [web] +targets: + - name: web + kind: web + title: The web UI's main flows + project: web diff --git a/AULA.md b/AULA.md new file mode 100644 index 0000000..3346500 --- /dev/null +++ b/AULA.md @@ -0,0 +1,48 @@ +# Ianitor Domi + +*Ianitor* (Latin: the doorkeeper) is the reverse proxy of a home server. It decides which name goes to which +service, with which certificate, and who has to sign in first. Every change is tried before it stays. + +- **Hosts in plain words.** Add a host, say where its traffic goes, and pick a Domi or Let's Encrypt certificate. + Choose whether visitors sign in first (Authelia forward-auth). Each host is checked for health and shows as + healthy, degraded or down. +- **Changes that undo themselves.** Every change is compiled, tried, and watched for 60 seconds. If a host stops + answering, the change is reverted on its own. Routes live in a git repository, one file per host, with Undo and a + history you can restore any kept version from. +- **Two engines.** Cloudflare's Pingora serves. Caddy is built from the same routes, compared with Pingora host by + host, and can take over at runtime in about two seconds. +- **The Domi certificate authority.** It issues certificates for hosts reached only from home, and device + certificates (mTLS) for phones, computers and Domi apps. They come from an intermediate whose root stays offline. +- **Share links**, signed and time-limited, for a single host. +- **Every action in three clicks or fewer**, in a dark web UI that only the signed-in owner reaches. + +## For whom + +For someone who runs services at home (a wiki, photos, music, cameras) and wants each one to have a name, a +certificate and a sign-in, without editing a proxy's config by hand and without a change that breaks the house. + +## Installing + +Ianitor runs on NixOS. There is nothing to download and run: the server builds it from source with Nix. + +1. Add the flake `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git` as an input of the server's flake, and + import its module `nixosModules.ianitor`. +2. Set `services.ianitor`: `enable`, the edge's listen addresses, the routes repository, the share-link key file + and, for the Domi CA, `pki`. Keys and passwords come from files the system provides (sops, systemd + credentials), never from the Nix store. Then rebuild. +3. Open the UI's name in a browser and sign in through Authelia. + +Ianitor can run beside an existing Caddy first, taking over one host at a time. Updates are a deploy: the server's +flake input moves to the new commit and the system switches, and switches back if the health check does not answer. + +## System requirements + +- NixOS on x86_64 Linux, with ports 80 and 443 for the edge. +- Authelia for sign-in to the UI and to the hosts that ask for it. +- A git server for the routes repository (any that takes a push over HTTPS). + +## The files on this page + +`ianitor--src.tar.gz` is the source of this version: every file in the repository at its tag. The +server's Nix build is made from the same tree. It is listed in `SHA256SUMS`, which verifies with domi-release. +The screenshots show invented hosts on an invented home server. diff --git a/scripts/pack-source.mjs b/scripts/pack-source.mjs new file mode 100644 index 0000000..33a278d --- /dev/null +++ b/scripts/pack-source.mjs @@ -0,0 +1,35 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// The release's one download (docs/release.md): the source of the commit being released, as +// target/release/ianitor-X.Y.Z-src.tar.gz (every file git tracks, under ianitor-X.Y.Z/) +// Ianitor ships no binary: the server builds it with Nix (docs/fabrica.md part 3). The archive is +// listed in the release's SHA256SUMS, signed by domi-release, so the source a version names can be +// checked. `git archive` of one tree gives the same bytes every time. +// node scripts/pack-source.mjs X.Y.Z +// Exit codes: 0 written, 1 git failed, 2 usage. + +import { spawnSync } from "node:child_process"; +import { mkdirSync, readdirSync, rmSync, statSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const repo = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const version = process.argv[2]; +if (process.argv.length !== 3 || !/^\d+\.\d+\.\d+$/.test(version)) { + console.error("usage: node scripts/pack-source.mjs X.Y.Z"); + process.exit(2); +} + +const out = join(repo, "target", "release"); +mkdirSync(out, { recursive: true }); +for (const n of readdirSync(out)) if (/^ianitor-.*-src\.tar\.gz$/.test(n)) rmSync(join(out, n), { force: true }); + +const file = join(out, `ianitor-${version}-src.tar.gz`); +const git = spawnSync("git", ["archive", "--format=tar.gz", `--prefix=ianitor-${version}/`, "-o", file, "HEAD"], { cwd: repo, stdio: "inherit" }); +if (git.error || git.status !== 0) { + console.error(`pack-source: git archive failed${git.error ? `: ${git.error.message}` : ` (exit ${git.status})`}`); + process.exit(1); +} +console.log(`pack-source: ${file} (${statSync(file).size} bytes)`);