Documentation
¶
Overview ¶
Package provision orchestrates container provisioning steps via zmx. After SSH bootstrap (handled by rc.local), the Runner SSHes into the container as root, installs zmx, and executes named provisioning steps using zmx run. Each step runs in its own pty session, enabling structured status tracking (zmx list), output capture (zmx history), and interactive debugging on failure (zmx attach).
Index ¶
- func Script(steps []Step) string
- func StepNames(steps []Step) []string
- type Runner
- func (r *Runner) HasProvisionScript(ctx context.Context) bool
- func (r *Runner) History(ctx context.Context, name string) (string, error)
- func (r *Runner) InstallZmx(ctx context.Context) error
- func (r *Runner) IsProvisioned(ctx context.Context) bool
- func (r *Runner) List(ctx context.Context) (string, error)
- func (r *Runner) PollStatus(ctx context.Context, names []string) (string, bool)
- func (r *Runner) Run(ctx context.Context, step Step) error
- func (r *Runner) Wait(ctx context.Context, names ...string) error
- func (r *Runner) WaitProvisioned(ctx context.Context, setStatus func(string))
- type Session
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Runner ¶
Runner executes and monitors zmx provisioning steps over SSH.
func (*Runner) HasProvisionScript ¶
HasProvisionScript checks if the provision script was written to the container.
func (*Runner) InstallZmx ¶
InstallZmx downloads and installs the zmx binary inside the container.
func (*Runner) IsProvisioned ¶
IsProvisioned checks if the provision sentinel file exists.
func (*Runner) List ¶
List runs zmx list and returns the raw output. The caller can display this directly or parse it for structured status information.
func (*Runner) PollStatus ¶
PollStatus checks zmx list and returns a human-readable status string and whether all expected steps are done. Returns ("", false) if zmx isn't ready yet or the list fails.
func (*Runner) Run ¶
Run starts a provisioning step via zmx run. The command returns immediately; the step executes in the background inside its own pty session.
type Session ¶
type Session struct {
Name string
EndedAt string // unix timestamp or empty if still running
ExitCode string // exit code or empty if still running
}
Session holds parsed fields from a zmx list output line.
func ParseSessions ¶
ParseSessions parses zmx list output into sessions.
type Step ¶
type Step struct {
Name string // zmx session name (e.g., "px-egress")
Script string // shell command to execute inside zmx
Finalize string // optional: runs after ALL steps complete (not tracked by zmx)
}
Step defines a named provisioning task to run via zmx.