runner

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDir

func EnsureDir(ctx context.Context, host *inventory.Host, dir string) error

EnsureDir verifies that dir is writable on host, creating it and fixing ownership via sudo if not. Returns nil when the directory is ready.

Types

type ComposeAction

type ComposeAction string
const (
	ActionUp      ComposeAction = "up -d"
	ActionDown    ComposeAction = "down"
	ActionRestart ComposeAction = "restart"
)

type ExecOptions

type ExecOptions struct {
	Stack      string
	ComposeDir string
	Service    string
	Cmd        []string
	Stdin      io.Reader
	Stdout     io.Writer
	Stderr     io.Writer
}

type LocalRunner

type LocalRunner struct{}

func (*LocalRunner) ComposeRun

func (r *LocalRunner) ComposeRun(ctx context.Context, opts RunOptions) (string, error)

func (*LocalRunner) CopyStack

func (r *LocalRunner) CopyStack(_ context.Context, opts RunOptions) error

func (*LocalRunner) Exec

func (r *LocalRunner) Exec(ctx context.Context, opts ExecOptions) error

func (*LocalRunner) Logs

func (r *LocalRunner) Logs(ctx context.Context, opts LogOptions) error

func (*LocalRunner) Ping

func (r *LocalRunner) Ping(_ context.Context) error

type LogOptions

type LogOptions struct {
	Stack      string
	ComposeDir string
	Follow     bool
	Writer     io.Writer
}

type RemoteRunner

type RemoteRunner struct {
	// contains filtered or unexported fields
}

func (*RemoteRunner) ComposeRun

func (r *RemoteRunner) ComposeRun(ctx context.Context, opts RunOptions) (string, error)

func (*RemoteRunner) CopyStack

func (r *RemoteRunner) CopyStack(ctx context.Context, opts RunOptions) error

func (*RemoteRunner) Exec

func (r *RemoteRunner) Exec(ctx context.Context, opts ExecOptions) error

func (*RemoteRunner) Logs

func (r *RemoteRunner) Logs(ctx context.Context, opts LogOptions) error

func (*RemoteRunner) Ping

func (r *RemoteRunner) Ping(ctx context.Context) error

type RunOptions

type RunOptions struct {
	Stack      string
	StackPath  string // absolute local path to the stack directory
	ComposeDir string // remote base directory (ignored for local runner)
	Action     ComposeAction
	Pull       bool
	DryRun     bool
	Commit     string
}

type Runner

type Runner interface {
	// CopyStack transfers the stack directory to the target.
	CopyStack(ctx context.Context, opts RunOptions) error

	// ComposeRun executes a docker compose action and returns combined output.
	ComposeRun(ctx context.Context, opts RunOptions) (string, error)

	// Logs streams docker compose logs to opts.Writer.
	Logs(ctx context.Context, opts LogOptions) error

	// Exec runs a command inside a running service container.
	Exec(ctx context.Context, opts ExecOptions) error

	// Ping verifies the runner target is reachable.
	Ping(ctx context.Context) error
}

Runner abstracts local vs remote compose operations.

func New

func New(host *inventory.Host) (Runner, error)

New returns the appropriate Runner for the given host.

Jump to

Keyboard shortcuts

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