Architecture
sequenceDiagram
participant CI as GitHub Actions
participant W as webhook (host)
participant R as muelle-receive
participant K as muelle-worker
CI->>CI: build, upload-artifact
CI->>W: POST /hooks/#lt;site#gt; (HMAC-signed)
W->>W: check HMAC
W->>R: payload
R->>R: validate against the Nix site table, spool
R-->>K: detach worker
R-->>CI: {id, url} (through webhook)
K->>K: download artifact (GITHUB_TOKEN), check sha256
K->>K: extract, flip current, prune
loop until success or failure
CI->>W: GET /status/#lt;id#gt;
W-->>CI: status file
end
CI->>CI: set GitHub Deployment state
Pull, not push
CI never gets shell access to the host and never applies NixOS configuration. It can only ask the host to fetch a build of a site the NixOS module declares, into an environment the module allows. The module is the only authority on which sites, environments and paths exist; the payload only picks among them.
Pieces
- Receiver: adnanh/webhook via
services.webhook, one hook per site,payload-hmac-sha256rule, secret loaded with systemdLoadCredential. Once the signature checks out it runsmuelle-receive(muelle.receive), which validates the payload against the site table generated by the module, writes it to the spool, detaches the worker and answers with the job’s id and URL. - Worker (
muelle.worker): downloads the artifact, checks its sha256, extracts it safely into a new release, flips the slot’scurrentsymlink, prunes old releases and previews, and keeps the status file updated. - Client (
muelle.client): run by the composite action; signs the payload, polls/status/#lt;id#gt;until the job ends, and reports GitHub Deployment state. - Listing (
muelle.index): staticindex.htmlandindex.json, regenerated on every hook request and daily. - Admin CLI (
muelle.cli): the same operations from the host, without CI.
All of it is one Python package without runtime dependencies. The client
imports only muelle.protocol and the
standard library, so the action runs it straight from the checkout.
Credentials
The host holds no GitHub credentials. The workflow’s short-lived
GITHUB_TOKEN is passed in the signed payload and used only to download the
artifact, which must live under https://api.github.com/repos/<repo>/ of the
site’s repo. The token stays valid while the action waits for the host.
Layout
<baseDir>/<site>/<slot>/releases/<sha> plus a current symlink. Slots are
prod, next, and an 8-hex hash of site + branch + sha per preview. Static
content needs no nginx reload: the symlink flip is atomic. See
Operating the host.