Documentation
¶
Overview ¶
Package installer owns initial preflight, lifecycle, sequencing and completion.
Index ¶
- func FormatPreflightReport(results []PreflightResult) string
- func HandoffToAdminConsole()
- func RecommendDbCache(ramMB int) int
- func RunInstall(opts InstallOptions, frontend InstallFrontend) error
- func RunPreflight() (host.SSHObservation, error)
- func SetVersion(v string)
- func StageBoardAll() error
- type Hardware
- type InstallDecisions
- type InstallEvent
- type InstallFrontend
- type InstallOptions
- type InstallSession
- type InstallStep
- type InstallStepView
- type InstallView
- type InteractiveInput
- type PreflightResult
- type RunOutcome
- type RunResult
- type StepKind
- type StepPhase
- type StepStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPreflightReport ¶
func FormatPreflightReport(results []PreflightResult) string
FormatPreflightReport renders the full check list with every failure's reason.
func HandoffToAdminConsole ¶
func HandoffToAdminConsole()
HandoffToAdminConsole opens the owner TUI through a separate pseudo-terminal. runuser supplies the identity, login environment and PAM session. The original terminal retains its owner, and the original SSH login retains its identity. Installation is already complete; failure leaves connection instructions.
func RecommendDbCache ¶
RecommendDbCache maps detected RAM to a bitcoind dbcache (MB). Pure — unit-tested. Conservative table, capped at 2048: IBD gains flatten beyond that on a node that also runs LND and Tor, and the box must keep headroom for lnd's own footprint.
unknown / < 3 GB → 512 (the historical hardcode) ≥ 3 GB → 1024 ≥ 6 GB → 2048
func RunInstall ¶
func RunInstall(opts InstallOptions, frontend InstallFrontend) error
RunInstall is the `sudo vpn install` entry point.
func RunPreflight ¶
func RunPreflight() (host.SSHObservation, error)
RunPreflight reports all failed checks before lifecycle initialization. The returned SSH observation describes preflight time, not the effective owner policy that installation will establish and verify later.
func SetVersion ¶
func SetVersion(v string)
func StageBoardAll ¶
func StageBoardAll() error
StageBoardAll builds the complete board at install time: every fact that exists on this box right now. Facts whose source does not exist yet are SKIPPED, not failed; a fresh box has no wallet macaroon until the operator creates the wallet (that moment stages it), and no Syncthing facts until Syncthing is installed.
Types ¶
type Hardware ¶
type Hardware struct {
RAMMB int // MemTotal
DiskTotalGB int // filesystem holding the data dir
DiskFreeGB int
Cores int
}
Hardware is the detected machine profile shown to the operator.
func DetectHardware ¶
func DetectHardware() Hardware
DetectHardware reads the machine profile. Detection failures yield zero fields — rendered as "unknown", never fatal: the step informs a confirmation, and RecommendDbCache treats unknown RAM conservatively.
type InstallDecisions ¶
type InstallDecisions struct {
// Password is validated using the initial login-password policy.
Password loginpassword.Password
// GeneratedPassword is set only on the --unattended path
// (ruling vii: random generation survives only there);
// printed once at the end of the run, never logged.
GeneratedPassword string
// PasswordApplied is set by the identity step after
// chpasswd succeeded. The generated password is printed
// ONLY when this is set: on a resume that ledger-skips the
// identity step (or an --until=bake run that filters it
// out), this pass generated a password that was never
// applied — printing it would hand the operator a
// credential that does not work.
PasswordApplied bool
// DbCacheMB is the hardware-fit step's confirmed dbcache
// (ruling viii).
DbCacheMB int
}
InstallDecisions carries the wizard's answers into the engine steps. Collected before the steps run (interactively or by the unattended defaults) and read by step closures at execution.
type InstallEvent ¶
type InstallEvent struct {
Index int
Status StepStatus
Err error
Final bool
Result RunResult
CompletionErr error
}
InstallEvent reports ordered progress or the engine's terminal outcome.
type InstallFrontend ¶
type InstallFrontend func(InstallView, *InstallSession) (openConsole bool, err error)
InstallFrontend presents one root installation session. Returning requests a graceful stop; the installer joins admitted work before releasing its lock.
type InstallOptions ¶
type InstallOptions struct {
// Network from --testnet4 or --signet ("" = mainnet for a pristine host,
// or keep the interrupted lifecycle's recorded answer).
Network string
// Unattended runs without a TUI or prompts and generates a login password.
// SSH keys are configured by the owner after installation.
Unattended bool
// UntilBake runs only PhaseBake steps (image build
// pipeline, ruling iv). Requires Unattended. The run ends
// without terminal ledger status, without handoff, without the
// verification banner — first-boot steps are still owed.
UntilBake bool
}
InstallOptions carries the `vpn install` command line.
type InstallSession ¶
type InstallSession struct {
// contains filtered or unexported fields
}
InstallSession owns one execution, independently of progress consumption. Stop prevents admission of another step; it does not kill an active subprocess or undo its changes. Forced process death still relies on lifecycle resume.
func (*InstallSession) Events ¶
func (s *InstallSession) Events() <-chan InstallEvent
Events supplies one ordered stream for the frontend's single observer.
func (*InstallSession) Start ¶
func (s *InstallSession) Start(input InteractiveInput) error
Start validates and freezes choices before admitting the first step. It may be retried after a decision error, but a started or stopped session is final.
func (*InstallSession) Stop ¶
func (s *InstallSession) Stop()
Stop requests a stop after the admitted step and its ledger publication.
type InstallStep ¶
type InstallStep struct {
// Key is the stable, versionless ledger key ("tor.install",
// "btc.download"). Names carry versions and copy edits; keys
// identify the step across binary versions.
Key string
// Name is display-only.
Name string
Fn func() error
Kind StepKind
Group string // resume-atomic pipeline; "" = self-contained
Phase StepPhase
Status StepStatus
Err error
}
func FilterPhase ¶
func FilterPhase(steps []InstallStep, until StepPhase) []InstallStep
FilterPhase returns the steps whose Phase is at or before until — the image pipeline's `--until=bake` slice (ruling iv plumbing; the CLI that passes a phase arrives with the commit-6 dispatch).
type InstallStepView ¶
type InstallStepView struct {
Name string
Status StepStatus
Err error
}
InstallStepView describes a step without granting execution authority.
type InstallView ¶
type InstallView struct {
NeedIdentity, NeedHardware bool
Hardware, Minimum Hardware
DBCacheChoices []int
RecommendedDBCache int
Steps []InstallStepView
Address string
}
InstallView contains observations and presentation data, never ledger access or executable installation steps.
type InteractiveInput ¶
type InteractiveInput struct {
Password loginpassword.Password
DBCacheMB int
}
InteractiveInput contains the operator's confirmed installation choices.
type PreflightResult ¶
PreflightResult is one check's outcome. Err == nil means pass.
type RunOutcome ¶
type RunOutcome int
RunOutcome distinguishes the three ways a runner ends. Terminal lifecycle status is derived only from RunComplete plus successful finalization.
const ( RunComplete RunOutcome = iota RunFailed RunInterrupted )
type RunResult ¶
type RunResult struct {
Outcome RunOutcome
StepName string // failed / interrupted-at step ("" if complete)
StepNum int // 1-based
Total int
Err error // the failed step's error
}
func RunInstallUnattended ¶
func RunInstallUnattended( steps []InstallStep, version string, ledger *installLedger, ledgerPath string, ) (RunResult, error)
RunInstallUnattended executes steps with no TUI: one plain line per step to stdout, same runner, same ledger, same log trail. Its consumers are `vpn install --unattended` and the image build pipeline. Interruption needs no handling here: a killed process leaves the ledger truthful by write ordering.
type StepPhase ¶
type StepPhase int
StepPhase classifies a step for the image pipeline (ruling iv): bake steps run at image-build time, first-boot steps must run on the deployed box (identity, hardware, SSH, and machine-specific staging).
type StepStatus ¶
type StepStatus int
const ( StepPending StepStatus = iota StepRunning StepDone StepFailed // StepSkipped renders a resume skip: the ledger records a // prior completion, the step did not execute this pass. StepSkipped )