Repository navigation
doc: deployment architecture — a services layer outside the system switch - #5764
Conversation
…itch Design proposal (WS-E): a flake-built `deploy` tool and per-service generations so services deploy without a system switch or home-manager activation; generalizes the 2026-10-31 Cloudflare deploy standard; containers from scratch via Nix; declarative libvirt/microVM guests with a named mutable carve-out class. Grounded in a 2026-11-04 inventory of the laptop, sandbox, and Cloudflare estate.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37f62be9c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| removed in the same change that proves it), and **none requires a system | ||
| switch to land** — the only system-flake change in the whole program is | ||
| adding the `deploy` package and the `deployTargets` output. |
There was a problem hiding this comment.
Define an explicit handoff of Home Manager unit ownership
For the M2 and M4 migrations, replacing the live unit files does not relinquish Home Manager's ownership: home/common/default.nix:876-904 declares both brokers, and nixos/services/pm-stack/default.nix:106 onward declares the PM units. The broker comment at home/common/default.nix:873-875 explicitly confirms that HM replaces hand-installed units on activation. Under this additive-only migration, a subsequent ordinary system switch can therefore restore the old broker binaries and checkout-backed PM services over the independently deployed generations. Include an ownership-removal activation, or specify a durable override strategy, and verify that migrated services survive a subsequent HM/system activation.
Useful? React with 👍 / 👎.
| Failure at any step: the profile flips back and the unit restarts on the | ||
| previous generation — deploy-rs's magic-rollback idea, with nix profiles | ||
| as the mechanism instead of a bespoke one. `rollback` is the same flip |
There was a problem hiding this comment.
Restore the previous unit configuration during rollback
When a deployment changes rendered unit arguments or environment and then fails its health check, the prescribed profile flip and restart leave systemd using the failed generation's loaded unit configuration. The previous executable can therefore restart with incompatible new arguments or environment instead of recovering the working generation. Forward activation explicitly writes the unit and reloads systemd, but the rollback recipe omits those corresponding steps; systemctl --help describes daemon-reload as “Reload systemd manager configuration.” Specify that rollback also restores or relinks the previous generation's rendered unit and performs daemon-reload before restarting.
Useful? React with 👍 / 👎.
| user = "user"; # or a systemd DynamicUser where suitable | ||
| ports = [ 4801 ]; | ||
| restart = "on-failure"; | ||
| healthCheck = "http://100.99.113.103:4801/health"; |
There was a problem hiding this comment.
Use the queue broker's unauthenticated health endpoint
For the fleet serve queue-broker target shown here, /health is not an ordinary HTTP health probe: pkgs/fleet/crates/fleet-queue/src/queue_broker.rs:640-645 permits unauthenticated GET requests only to /healthz, while other paths require authentication and POST. A GET to the configured URL therefore returns 401 without credentials or 405 with credentials, causing a healthy deployment to fail its activation check and roll back. Use http://100.99.113.103:4801/healthz, which is also the endpoint exercised by the broker smoke test.
Useful? React with 👍 / 👎.
Design proposal from the WS-E pass (Drew, 2026-11-04): get services out of the system switch's blast radius.
Core of the design
deploybinary gives every service its own generations:deploy <target>builds + activates just that service,deploy <target> rollbackrepoints to the previous generation,deploy <target> statusis the audit surface. No system switch, no home-manager activation, no reboot.pkgs/mcpx/modules/and the forks' openchamber→opencode→mcpx cascade already prove in-tree.deployabsorbs the existing<name>-deployflake apps rather than replacing them.dockerTools/nix2container) for software we own — the lab-ops-hub crawler is the working precedent; third-party images stay digest-pinned.amd-crdcurrently has no definition in any repo and gets a definition-or-waiver decision.Grounded in a fresh inventory of the laptop, sandbox, and Cloudflare estate. Headline receipts: the hand-placed route-proxy unit is broken right now (ExecMainStatus 127, its start script missing); the laptop-agent's Nix module exists but a hand unit is what runs; darwin-nix's fleet-brokers module is enabled by no machine while the code flake re-declares the same brokers; pm-stack runs out of the primary checkout; sandbox quota-recorder has no installer and is hand-restored after every recycle.
Migration order: M1 route-proxy → M2 fleet three (laptop-agent + brokers) → M3 sandbox quota-recorder → M4 pm-stack off the checkout, with a parallel Cloudflare track. Each step reversible; the only system-flake change in the whole program is additive (the
deploypackage +deployTargetsoutput).Design + filings only — no migration is executed by this PR.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.