deploy

package
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRemoteUser is applied when no remote user is provided.
	DefaultRemoteUser = "root"
	// DefaultSSHPort is used when no SSH port is specified.
	DefaultSSHPort = 22
)

Variables

View Source
var Version = "dev"

Version identifies the bootstrap script bundle.

Functions

func BuildSSHArgs

func BuildSSHArgs(identity string, port int) []string

BuildSSHArgs constructs SSH args with non-interactive defaults suitable for bootstrap.

func BuildScpArgs

func BuildScpArgs(identity string, port int) []string

BuildScpArgs constructs scp args with strict host key defaults.

func DefaultExports

func DefaultExports() map[string]string

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

func PrefixedScript(env map[string]string) string

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

func RandomHexString(length int) (string, error)

RandomHexString returns a random hex string of the requested length.

Types

type IOStreams

type IOStreams struct {
	Stdout io.Writer
	Stderr io.Writer
}

IOStreams represents command IO endpoints.

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.

func (RunnerFunc) Run

func (fn RunnerFunc) Run(ctx context.Context, command string, args []string, stdin io.Reader, streams IOStreams) error

Run executes the underlying function.

type SystemRunner

type SystemRunner struct{}

SystemRunner executes shell commands using the host environment streams.

func (SystemRunner) Run

func (SystemRunner) Run(ctx context.Context, command string, args []string, stdin io.Reader, streams IOStreams) error

Run invokes the command with inherited stdio defaults when streams are nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL