Add allod site preview to serve a site with the generator its build pins #180
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#180
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?
Let an author see a site change in a browser before publishing it, rendered by the same generator version the deploy build uses, with one command run from anywhere inside the site repository.
Primary goals:
allod site previewstarts a live-reloading local server for the site whosesite.tomlis found by walking up from the current directory, the waydeployalready resolves the root. The author needs no generator on PATH and no knowledge of which nixpkgs the site pins.nix shell --inputs-from <root> nixpkgs#zola --command zola serve .... What the author sees is rendered by the versionallod site deploywill build with, and a channel bump in the site repository moves both together. A barezola servewith whatever is on PATH would not have that property.sitebuild tag; that tag exists to keep the destructive deploy off exactly those machines.base_urlto its listening address underserve, so navigating the preview never escapes to the live site. Preview never reads the rclone config, never runs the remote preflight, and takes no--config.--port,--interface,--base-url,--draftsand--openmirror zola's flags; anything after--goes to zola verbatim. Default is zola's own:127.0.0.1:1111.Current state and specifics
The manual equivalent works today and is the whole implementation of the happy path: from a site repository,
nix shell --inputs-from . nixpkgs#zola --command zola servestarts zola 0.21.0 on a site whose lock pins nixos-25.11, builds 23 pages, and rewrites every link tohttp://127.0.0.1:1111/.... Nobody discovers that command, and it is easy to run the wrong zola instead.The
sitenamespace is registered frominit()incmd/allod/site.go:243, in a file that begins//go:build site. An untagged build carries nositeword at all (cmd/allod/main.go:37-64; README, "Optional namespaces"). A preview that lived only in the tagged build would exist only on the publishing host, which is the one machine nobody edits a site on. So this change splits the namespace:preview,findSiteRoot(cmd/allod/site.go:272) and thesite.tomlparser compile unconditionally, and the tagged file addsdeploy,checkandconfigto that same namespace.registerNamespacepanics on a duplicate word (cmd/allod/main.go:60), so the tagged file extends the namespace rather than registering a secondsite. Usage text lists only the commands the binary carries: on a dev machineallod siteshowspreviewalone, andallod site deploythere is an unknown command, which is true.The generator is hardcoded to zola. The site derivation owns the choice of generator (the site repository's
nix/site.nix) and preview cannot read it. When a second generator appears, the shape is ageneratorkey insite.tomlor apreviewapp the site flake exposes, not a guess in this command;site.tomlignores unknown keys today (cmd/allod/site.go:318), so adding one later is compatible. Until then, zola is the one value in use.Preview binds loopback by default and a dev machine's firewall does not open it. Viewing from the host's browser is an SSH tunnel:
ssh -L 1111:127.0.0.1:1111 <vm>and thenhttp://127.0.0.1:1111. The usage text should say so, because that is where the first user will be stuck.Validation: on an untagged build inside a site repository,
allod site previewprints the URL and serves with live reload,allod site deployis unknown, andallod siteoutside a site repository fails the waydeploydoes today (cmd/allod/site.go:289). On a-tags sitebuild,allod sitelists all four commands. Bothgo test ./...andgo test -tags site ./...cover the namespace in both shapes, as the README already requires.Scope
In: the
previewcommand, the namespace split between tagged and untagged builds, usage text, tests, and the README's "Optional namespaces" section.Out: generator abstraction (trigger: a second generator in a site repository); deployment package changes (dev machines already build
cmd/alloduntagged, so the command arrives with the next pin advance); and the hosting credential lifecycle, which isallod/tools#163 andallod/tools#164 (both closed) plus the deployment-side composition they left to each deployment.