Static sites: one host profile, a builder per generator, an entry per site #57
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/archetypes#57
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Organise static sites as one host profile, one builder per site generator, and one small entry per site, so adding a site is a configuration change rather than a new machine definition.
Primary goals:
Why the split falls here
A machine profile per generator would be the obvious shape and it is wrong: the machine only ever sees a directory of files, because the generator has finished before the machine exists. Putting the generator in the machine profile would force a new profile for every tool, and would rebuild the machine to change a tool it never runs.
Deploy model
CI builds the artifact and pushes it to the host, which is how the imperative predecessor worked. This does not weaken the declarative property. The published content is a function of two version-controlled repositories and an automated job, so a destroyed machine is rebuilt from its flake and the job re-run — the files on disk are a cache of a reproducible computation, not state that must be carried across a recreation. It also keeps publishing cheap: a typo fix is a CI run rather than a machine rebuild, and rolling content back is re-running an earlier job.
Two things that must move with the deploy model
The symlink check has to run in CI. A shortcut file in the published tree that points outside it —
leak -> /etc— is followed by Caddy's file server at request time and publishes host files. Today a Nix build refuses such content, but under CI-driven deploys Nix never sees what is served, so that protection stops covering it. Caddy cannot serve as a backstop: its only symlink option,reveal_symlinks, governs directory listings and not whether links are followed. The same check therefore has to run in the job before it pushes.The deploy credential must be narrow. Whatever runs the job can change what a public machine serves. Restrict it to a forced command writing one directory rather than a general login.
Scope
In scope: the host profile's parameterisation over a served path, a Zola builder, a site entry for the first real site, and the CI job with its symlink check and restricted key.
Tracked elsewhere: the existing machine definition and its measurement (allod/archetypes#56), and the public-host base it composes onto (allod/archetypes#55).
Out of scope for now: further generators. Zola first; a second builder is a small function when something needs it.
Refs allod/archetypes#55, allod/archetypes#56.
Progress after #58 merged: archetypes now exports the generator-independent
nixosModules.staticSitehost module andlib.buildZolaSite, with the carried content/security checks and a first-boot VM witness.This issue should remain open. #58 intentionally stopped before the site entry, host/profile ownership, CI-on-commit deployment, and narrow forced-command deploy credential described here.
Closing: the deliverable already exists, and this issue describes moving it in a direction that has since been decided against.
static-site-partsis a complete standalone flake servinghashpool.dev:nixosConfigurations.pages, its own static-site module, its own checks, and a site builder. Its last commit is "Serve the real website instead of a placeholder". It is one line — the operator public key, deliberately left empty for a human — from being installable.This issue asked for a host profile parameterised over a served path, a builder per generator, a site entry, and CI-on-commit publishing. The first three exist in that repo already. The fourth is deferred: content-in-closure has fewer moving parts than a CI push — no runner, no deploy key, no rsync target — and it keeps the symlink-escape guarantee where it is implemented and tested, because Nix stops seeing the served bytes the moment a job rsyncs them. The trigger to revisit is publishing cadence rather than preference, and the reversal costs one vhost body plus moving the symlink check into the pipeline.
The structural finding behind this closure is recorded on
allod/archetypes#60: a rented host has none ofinventory's facts, so it belongs in the management path (one lock, onefollowsdiscipline, uniformnixos-rebuild --flake) and outside the data-model path (builder dispatch,vmFacts, the identity join). Extractingstatic-site-partsinto an archetype was that mistake in another form.The two protections this issue rightly identified stand and are not lost. The symlink check must move into CI if publishing ever moves there, and a deploy credential must be a forced command rather than a general login. Both belong to whoever builds that path, on a fresh issue, when cadence justifies it.
Closed as not planned.