plan

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: 9 Imported by: 0

Documentation

Overview

Package plan merges the compose project with the ferry.yaml overlay into resolved deploy targets. Compose is the source of truth for what a service is; ferry.yaml adds where it runs and how it is exposed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plan

type Plan struct {
	Config  *config.Config
	Project *types.Project
	Targets []*Target
}

Plan is the fully resolved deployment model, targets in dependency order.

func Load

func Load(cfg *config.Config) (*Plan, error)

Load reads the compose project and resolves it against cfg.

func (*Plan) CrossServerEnv

func (p *Plan) CrossServerEnv(target *Target, server *config.Server) map[string]string

CrossServerEnv returns FERRY_SERVICE_<NAME>_HOST entries for every other deployed service that does not run on the given server — the 12-factor escape hatch since Docker networks don't span hosts.

func (*Plan) PreviewDomain

func (p *Plan) PreviewDomain() (string, error)

PreviewDomain returns the base domain previews hang off: preview.domain, else the primary service domain, else an sslip.io fallback.

func (*Plan) PreviewServer

func (p *Plan) PreviewServer() (*config.Server, error)

PreviewServer resolves the preview server: preview.server, else the first server of the first proxied service.

func (*Plan) PreviewServices

func (p *Plan) PreviewServices() ([]*Target, error)

PreviewServices returns the targets deployed by `ferry preview` (preview.services, default all), in dependency order.

func (*Plan) Select

func (p *Plan) Select(names []string) ([]*Target, error)

Select returns the named targets in dependency order; empty names = all.

func (*Plan) Target

func (p *Plan) Target(name string) (*Target, error)

Target returns a deploy target by service name.

func (*Plan) Warnings

func (p *Plan) Warnings() []string

Warnings returns non-fatal config issues: depends_on edges that cross servers, where startup ordering is only best-effort, and stateful services whose data would not survive a recreation.

type Target

type Target struct {
	Name    string
	Overlay *config.Service
	Compose types.ServiceConfig
	Servers []*config.Server
	// contains filtered or unexported fields
}

Target is one deployable service: a compose service plus its overlay, resolved against concrete servers.

func (*Target) BuildContextDir

func (t *Target) BuildContextDir() string

BuildContextDir returns the absolute build context directory for a versioned service (shipping it to a build host needs the real path).

func (*Target) BuildMethod

func (t *Target) BuildMethod() string

BuildMethod resolves to "remote" or "pull": per-service override, global build.method, else remote when compose has build:. Image-only services (postgres:16, ...) are always pull — there is nothing to build.

func (*Target) Config

func (t *Target) Config() *config.Config

Config returns the owning config.

func (*Target) ContainerName

func (t *Target) ContainerName(version string) string

ContainerName returns the versioned container name (Kamal-style: no renames, no color juggling). Stateful services get a stable, project- prefixed name instead (container names are host-global): their lifecycle follows config changes, not app versions.

func (*Target) DomainsOn

func (t *Target) DomainsOn(server *config.Server) []string

DomainsOn returns the domains for this service on a given server; without configured domains it falls back to <service>.<ip-with-dashes>.sslip.io so first contact needs zero DNS setup.

func (*Target) ImageRef

func (t *Target) ImageRef(version string) string

ImageRef returns the image reference to build/pull/run for a version.

func (*Target) Port

func (t *Target) Port() int

Port returns the container port the proxy targets: the overlay port, else the first compose expose entry, else the first compose ports target.

func (*Target) Proxied

func (t *Target) Proxied() bool

Proxied reports whether the service is registered with kamal-proxy: it has a domain, or an explicit port (which gets an sslip.io fallback domain).

func (*Target) ProxyService

func (t *Target) ProxyService() string

ProxyService returns the kamal-proxy service name, prefixed with the project name: kamal-proxy keys registrations by service name globally per server, so two projects sharing a server with a same-named service would otherwise clobber each other's routing and TLS host allowlist.

func (*Target) RunsOn

func (t *Target) RunsOn(server *config.Server) bool

RunsOn reports whether the target is mapped to the given server.

func (*Target) Stateful

func (t *Target) Stateful() bool

Stateful reports whether the service converges in place: stable container name, recreated only when its effective configuration changes — never bounced just because the app version moved.

func (*Target) Versioned

func (t *Target) Versioned() bool

Versioned reports whether this service's image is tagged with the git SHA. Image-only services (postgres:16, redis, ...) deploy the compose image verbatim.

Jump to

Keyboard shortcuts

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