feat(templates): LXC container and chained web server notebooks (#11)
infra/lxc-container.md creates an unprivileged container on a Proxmox host with ShellBook's key, waits for its address and adds it to Hosts. services/web-server.md installs nginx on an existing host or on a new container through ::use. Document chaining in the spec (3.6) and in the workspace format guide.
This commit is contained in:
@@ -118,12 +118,51 @@ Info string: `sh {<kind> key=value key="value with spaces" flag}`. Language `sh`
|
||||
`:::after{step=<id>}` … `:::` — rendered only after that step succeeded in the
|
||||
current session. `:::after{step=<id> failed}` for the failure case. (remark-directive syntax.)
|
||||
|
||||
`:::when{param=a,b}` … `:::` — shown, and its steps runnable, only while the `choice` (or
|
||||
other non-secret) parameter has one of the listed values. The server refuses to run a
|
||||
step inside an inactive section. Values must be options of a `choice` parameter.
|
||||
|
||||
### 3.5 Artifacts
|
||||
|
||||
Each `on=local` run gets a fresh workdir under `data/runs/<run-id>/`. Artifacts are kept
|
||||
for 24 h (configurable), then deleted. Private keys are flagged sensitive: one download
|
||||
only, then removed.
|
||||
|
||||
### 3.6 Chained notebooks
|
||||
|
||||
A notebook can include another one and continue with what it produced, e.g. a service
|
||||
notebook that first creates an LXC container:
|
||||
|
||||
```markdown
|
||||
:::when{target=lxc}
|
||||
::use{notebook="infra/lxc-container.md" as=ct with="hostname={{server_name}}"}
|
||||
:::
|
||||
```
|
||||
|
||||
- `::use{notebook="dir/name.md" as=alias with="p={{x}}, q=1"}` — path relative to
|
||||
`notebooks/`, no `..`. The server composes the notebook (core `composeNotebook`):
|
||||
the included params, step ids, captures and templates are namespaced by the alias
|
||||
(`ct.hostname`, `ct.create`, `{{ct.address}}`) and shown inline as a collapsible
|
||||
section with its own parameter group. Nested includes chain aliases (`svc.ct.x`); at
|
||||
most 4 levels. Missing files, cycles and errors inside the included notebook are
|
||||
errors on the `::use` line. The UI reloads when an included file changes.
|
||||
- `with` sets defaults of the included params, written in the including notebook's
|
||||
namespace. Secrets cannot be bound; they are entered in the form and passed only to
|
||||
steps of their own notebook, under their local name (`$ROOTPW`).
|
||||
- Required params gate only steps of their own notebook (scope); a step also needs every
|
||||
value it references.
|
||||
- Non-secret defaults may reference captures and builtins (`default: "{{ct.host}}"`). Until
|
||||
the value exists the field shows "Available after the step that sets ct.host". A
|
||||
required param that waits for a capture of its own notebook would block the step
|
||||
producing it; make such params optional.
|
||||
- `::host{name="{{hostname}}" address="{{address}}" user=root port=22 capture=host}` adds
|
||||
the machine to Hosts (same validation as the Hosts page; never overwrites a different
|
||||
host with that name). `capture` stores the host name as a runtime value so later
|
||||
steps can target it. The first SSH connection still requires host key confirmation.
|
||||
- Builtins are server-provided runtime values, never namespaced:
|
||||
`{{shellbook.public_key}}` is ShellBook's SSH public key. The server sets them on every
|
||||
run; client-sent values are ignored.
|
||||
|
||||
## 4. Execution
|
||||
|
||||
- Scripts run as `bash -euo pipefail -s` with the script on stdin; no TTY.
|
||||
|
||||
Reference in New Issue
Block a user