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 ¶
- type Deployer
- func (d *Deployer) Deploy(targets []*plan.Target) error
- func (d *Deployer) DeployPreview() error
- func (d *Deployer) Docker(s *config.Server) (*exec.Docker, error)
- func (d *Deployer) EnsureImage(t *plan.Target, s *config.Server) (string, error)
- func (d *Deployer) Host(s *config.Server) *exec.Host
- func (d *Deployer) ListPreviews() ([]Preview, error)
- func (d *Deployer) MergedEnv(t *plan.Target, s *config.Server) (map[string]string, error)
- func (d *Deployer) PrimaryServer() *config.Server
- func (d *Deployer) Prune(dk *exec.Docker, t *plan.Target) error
- func (d *Deployer) ReapExpired() error
- func (d *Deployer) RemovePreview(sha string) error
- func (d *Deployer) Rollback(targets []*plan.Target, version string) error
- type Preview
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 ¶
Deploy runs the full flow for the given targets (dependency order, rolling across each target's servers).
func (*Deployer) DeployPreview ¶
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 ¶
Docker returns (creating if needed) the Docker context handle for a server.
func (*Deployer) EnsureImage ¶
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) ListPreviews ¶
ListPreviews discovers previews from container labels on the preview server — works from any checkout, no local state.
func (*Deployer) MergedEnv ¶
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 ¶
PrimaryServer is where the deploy lock and audit log live: the first server of the first target.
func (*Deployer) Prune ¶
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 ¶
ReapExpired removes previews older than preview.ttl (opportunistic, called on preview invocations).
func (*Deployer) RemovePreview ¶
RemovePreview tears down one preview: proxy targets, containers, volumes, network, images.