deploy

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeployWithClient

func DeployWithClient(cfg *config.Config, client Deployer, opts *Options) error

DeployWithClient performs a deployment with a custom client.

func OrderByDependsOn added in v0.19.4

func OrderByDependsOn(services map[string]*config.Config) []string

OrderByDependsOn returns service names ordered so every service comes after the dependencies it declares via depends_on — a stable (alphabetical tie-break) topological sort (Kahn's algorithm). Deploy-all uses it so a dependency (e.g. a database) is started and Ready before a dependent whose readiness probe needs it; iterating alphabetically would start the dependent first and deadlock on its progress deadline.

depends_on entries that name a non-service are ignored. Services caught in a cycle are appended in alphabetical order so a bad depends_on never drops a service from the deploy.

func RestartWithClient

func RestartWithClient(cfg *config.Config, client Deployer, opts *Options) error

RestartWithClient restarts a service without building a new image

func RollbackWithClient

func RollbackWithClient(cfg *config.Config, client Deployer, opts *Options) error

RollbackWithClient rolls back to the previous version

func TransitiveDeps added in v0.20.0

func TransitiveDeps(named []string, services map[string]*config.Config) []string

TransitiveDeps returns the named services plus every service reachable through depends_on edges, de-duplicated. A targeted deploy uses it to pull in the dependencies a named service needs. Names absent from services are kept (so the caller can surface a bad name) but contribute no edges. The seen-guard bounds the walk and makes cycles terminate. Order is unspecified — callers that care should sort or OrderByDependsOn the result.

Types

type Deployer

type Deployer interface {
	GetCurrentVersion(ctx context.Context) (int, error)
	ReadManifest(ctx context.Context) (string, error)
	MakeTempDir(ctx context.Context) (string, error)
	Rsync(ctx context.Context, localPath, remotePath string) error
	BuildImage(ctx context.Context, buildDir string, version int) error
	UpdateManifest(ctx context.Context, version int) error
	RestartStack(ctx context.Context) error
	Cleanup(ctx context.Context, path string) error
	StackExists(ctx context.Context) (bool, error)
	CreateStack(ctx context.Context, content string) error
	EnsureNetwork(ctx context.Context, name string) error
	CreateEnvFiles(ctx context.Context, serviceNames []string) error
	UploadEnvFile(ctx context.Context, serviceName, localPath string) error
	IsServiceRunning(ctx context.Context, serviceName string) (bool, error)
	PullImage(ctx context.Context, image string) error
	StartService(ctx context.Context, serviceName string) error
	RolloutService(ctx context.Context, serviceName string) error
	CopyFiles(ctx context.Context, files map[string]string) error
	// SetOutput redirects subprocess stdout/stderr for the next interactive
	// call (build, pull, start, rollout). Passing nil restores os.Stdout /
	// os.Stderr. Used to feed output into ui.Reporter's tail window.
	SetOutput(stdout, stderr io.Writer)
}

Deployer defines the interface for deployment operations

type Options

type Options struct {
	// Output is where to write progress messages (used only when Reporter is nil).
	Output io.Writer
	// Reporter renders deploy progress. When nil, a plain reporter is built
	// from Output (or io.Discard if Output is also nil).
	Reporter ui.Reporter
	// Dependencies maps dependency service names to their configs
	Dependencies map[string]*config.Config
	// AllServices maps all service names to their configs (used for initial stack creation)
	AllServices map[string]*config.Config
	// BuildOnly builds/pulls the image and updates the manifest but does not start the service.
	// Used by deploy-all: build everything first, then start all services at once.
	BuildOnly bool
	// Runtime is the deployment runtime ("compose" or "k3s")
	Runtime string
	// TagCleaner, if set, is invoked after a successful rollout to prune
	// old image tags per cfg.RetainTags(). Failures are warn-only; a deploy
	// never fails because cleanup failed. Pre-built images and BuildOnly
	// mode skip the hook entirely.
	TagCleaner TagCleaner
}

Options holds configuration for the deployment

type TagCleaner added in v0.15.0

type TagCleaner interface {
	PruneOldTags(ctx context.Context, image string, retention, running int) error
}

TagCleaner is the narrow surface DeployWithClient needs for post-deploy image tag cleanup. The full cleanup.ImageCleaner interface is wider; we only consume the orchestration entry point here to keep test seams small.

Jump to

Keyboard shortcuts

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