deploy

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package deploy implements the deploy, rollback and preview flows: context builds or registry pulls, git-SHA versioning, health-gated cutover via kamal-proxy, retention, lock and audit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployer

type Deployer struct {
	Plan      *plan.Plan
	Version   string
	Performer string
	Timeout   time.Duration
	SkipBuild bool
	Recreate  bool // force fresh containers even when nothing changed

	Log func(format string, args ...any)
	// contains filtered or unexported fields
}

Deployer carries one invocation's context: version, performer, flags.

func (*Deployer) Deploy

func (d *Deployer) Deploy(targets []*plan.Target) error

Deploy runs the full flow for the given targets (dependency order, rolling across each target's servers).

func (*Deployer) DeployPreview

func (d *Deployer) DeployPreview() error

DeployPreview deploys a preview environment for d.Version on the preview server: SHA-tagged build, isolated clones with fresh volumes for isolate services, per-preview TLS via kamal-proxy. Re-running on the same SHA replaces it.

func (*Deployer) Docker

func (d *Deployer) Docker(s *config.Server) (*exec.Docker, error)

Docker returns (creating if needed) the Docker context handle for a server.

func (*Deployer) EnsureImage

func (d *Deployer) EnsureImage(t *plan.Target, s *config.Server) (string, error)

EnsureImage makes the versioned image available on the server: skipped when it already exists (idempotent redeploys, rollback-forward), otherwise a context build on the host or a registry pull.

func (*Deployer) Host

func (d *Deployer) Host(s *config.Server) *exec.Host

Host returns the plain-SSH handle for a server.

func (*Deployer) ListPreviews

func (d *Deployer) ListPreviews() ([]Preview, error)

ListPreviews discovers previews from container labels on the preview server — works from any checkout, no local state.

func (*Deployer) MergedEnv

func (d *Deployer) MergedEnv(t *plan.Target, s *config.Server) (map[string]string, error)

MergedEnv is the fully merged environment for a target on a server, as a deploy would deliver it (used by `ferry env push|diff`).

func (*Deployer) PrimaryServer

func (d *Deployer) PrimaryServer() *config.Server

PrimaryServer is where the deploy lock and audit log live: the first server of the first target.

func (*Deployer) Prune

func (d *Deployer) Prune(dk *exec.Docker, t *plan.Target) error

Prune keeps the last build.retain stopped containers per service (the rollback depth) and removes older ones with their images. Stateful services have nothing retained: one stable container, no version history.

func (*Deployer) ReapExpired

func (d *Deployer) ReapExpired() error

ReapExpired removes previews older than preview.ttl (opportunistic, called on preview invocations).

func (*Deployer) RemovePreview

func (d *Deployer) RemovePreview(sha string) error

RemovePreview tears down one preview: proxy targets, containers, volumes, network, images.

func (*Deployer) Rollback

func (d *Deployer) Rollback(targets []*plan.Target, version string) error

Rollback restarts a retained container and re-registers it with kamal-proxy (health-gated like any deploy). No rebuild, no transfer. version "" means the most recently retained one.

type Preview

type Preview struct {
	SHA      string
	URL      string
	Created  time.Time
	Server   string
	Services []string
}

Preview describes one running preview environment.

Jump to

Keyboard shortcuts

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