diff --git a/docs/demo.md b/docs/demo.md index 675073e..a09deaa 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -20,6 +20,38 @@ demo # the agents' VM, on this terminal ## What's in it +```mermaid +flowchart TB + subgraph agentvm["Agents' VM (demo)"] + slop["slop, as agent"] + clone["~/repo"] + end + + browser["Browser"] + shell["devenv shell:
slop-approve, demo-merge"] + + subgraph host["Host (devenv up)"] + pocket["Pocket ID
localhost:1411"] + broker["Broker, with the web app
localhost:8095"] + daemon["git daemon"] + builder["Builder"] + repo[("repo.git")] + end + + subgraph boxvm["Box VM"] + sshd["sshd, as box
(nodes web, router, vault, box)"] + end + + slop -- "vsock" --> broker + clone -- "git://, through guestfwd" --> daemon --> repo + browser -- "sign in" --> pocket + browser --> broker + shell -- "approve.sock" --> broker + shell -- "moves master" --> repo + broker -- "SSH, through a wrapper" --> builder -- "fetches" --> repo + broker -- "SSH, localhost:2222" --> sshd +``` + | Part | Where | Runs | |---|---|---| | Broker, from this checkout (`cargo run`) | Host | `devenv up` (process `slop-broker`) | @@ -39,8 +71,8 @@ CID are in [`settings.nix`](../nix/demo/settings.nix). The broker's configuratio [the repository](#the-repository)). - **Approvers:** members of your primary group, through `slop-approve` in the devenv shell, and the Pocket ID user `demo` (in the group `slop-approvers`) through the web app. -- **Targets:** `box`, `web`, `router` and `vault` all reach the box VM; `box` is also the deploy - node. +- **Targets:** the repository's deploy-rs nodes on `master`, `box`, `web`, `router` and `vault`, + which all reach the box VM. Only `box` has a profile to deploy. - **Policy:** - The box queries (`slop status`, `slop logs`, `slop failed`) run without asking. - `slop ssh web` asks, and offers leases of 5 minutes or an hour. @@ -69,24 +101,27 @@ slop ssh web -- uptime ` in the devenv shell fast-forwards `master` to a branch, as a person +- **From [`nix/demo/repo`](../nix/demo/repo):** `flake.nix`, with the deploy-rs nodes and the + `demo` profile (see [Deploys](#deploys)). +- **Generated:** age keys for the demo person and the broker (`dev-age.key` and `broker-age.key` + in the state directory; the broker's approvals call the first `dev`), and secrets encrypted to + both: + - `secrets.nix`, the agenix rules; + - `secrets/app.env.age`, with `DB_USER` and `DB_PASSWORD`; + - `secrets/wg.key.age`, a WireGuard key, as a whole file. +- **Protected `master`:** a `pre-receive` hook refuses pushes to it, standing in for branch + protection. `demo-merge ` in the devenv shell fast-forwards it to a branch, as a person merging after review. - -The agents' VM clones it to `~/repo` at login. The `demo` script forwards `10.0.2.100:9418`, an -address only the VM sees, to a `git daemon` on the host for each connection (QEMU's `guestfwd`), -so the VM can fetch and push over `git://` and reach nothing else. - -The broker reaches its builder over SSH, as in a real deployment. Here its `ssh` is a wrapper that -runs `slop-broker builder` from this checkout's build when the host is `builder`, and the real -`ssh` otherwise. The builder fetches from the repository's path and evaluates with the host's Nix. +- **The agents' VM** clones it to `~/repo` at login, over `git://`. + - The `demo` script forwards `10.0.2.100:9418`, an address only the VM sees, to a `git daemon` + on the host for each connection (QEMU's `guestfwd`). + - So the VM can fetch and push, and reach nothing else. +- **The builder** is reached over SSH, as in a real deployment. + - The broker's `ssh` is a wrapper that runs `slop-broker builder` from this checkout's build + when the host is `builder`, and the real `ssh` otherwise. + - The builder fetches from the repository's path and evaluates with the host's Nix. ### Secrets