Documentation
¶
Index ¶
- Constants
- Variables
- func BuildSSHArgs(identity string, port int) []string
- func BuildScpArgs(identity string, port int) []string
- func DefaultExports() map[string]string
- func GenerateNodeID() string
- func PrefixedScript(env map[string]string) string
- func ProvisionHost(ctx context.Context, opts ProvisionOptions) error
- func RandomHexString(length int) (string, error)
- type IOStreams
- type ProvisionOptions
- type Runner
- type RunnerFunc
- type SystemRunner
Constants ¶
const ( // DefaultRemoteUser is applied when no remote user is provided. DefaultRemoteUser = "root" // DefaultSSHPort is used when no SSH port is specified. DefaultSSHPort = 22 )
Variables ¶
var Version = "dev"
Version identifies the bootstrap script bundle.
Functions ¶
func BuildSSHArgs ¶
BuildSSHArgs constructs SSH args with non-interactive defaults suitable for bootstrap.
func BuildScpArgs ¶
BuildScpArgs constructs scp args with strict host key defaults.
func DefaultExports ¶
DefaultExports provides baseline environment variables included in every bootstrap script. Callers can override/extend via map merge.
func GenerateNodeID ¶
func GenerateNodeID() string
GenerateNodeID creates a URL-safe node identifier.
func PrefixedScript ¶
PrefixedScript renders a shell script with an export preamble for env. Keys are emitted in sorted order for determinism.
func ProvisionHost ¶
func ProvisionHost(ctx context.Context, opts ProvisionOptions) error
ProvisionHost installs the ployd binary on the target host and executes the bootstrap script in the requested mode.
func RandomHexString ¶
RandomHexString returns a random hex string of the requested length.
Types ¶
type ProvisionOptions ¶
type ProvisionOptions struct {
Host string
Address string
User string
Port int
IdentityFile string
PloydBinaryPath string
Runner Runner
Stdout io.Writer
Stderr io.Writer
ScriptEnv map[string]string
ScriptArgs []string
ServiceChecks []string
}
ProvisionOptions configure remote host preparation using the embedded bootstrap script.
type Runner ¶
type Runner interface {
Run(ctx context.Context, command string, args []string, stdin io.Reader, streams IOStreams) error
}
Runner executes commands with the rendered script.
func NewSystemRunner ¶
func NewSystemRunner() Runner
NewSystemRunner creates a new system runner that executes commands via exec.
type RunnerFunc ¶
type RunnerFunc func(ctx context.Context, command string, args []string, stdin io.Reader, streams IOStreams) error
RunnerFunc adapts a function to the Runner interface.
type SystemRunner ¶
type SystemRunner struct{}
SystemRunner executes shell commands using the host environment streams.