config

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

Documentation

Index

Constants

This section is empty.

Variables

HookTypes lists all lifecycle hooks in execution order.

Functions

This section is empty.

Types

type Build

type Build struct {
	Method string `yaml:"method"` // "remote" | "pull" | "" (auto per service)
	Retain int    `yaml:"retain"` // stopped old-version containers kept per service
}

Build configures how images get onto servers.

type Command

type Command struct {
	Name        string `yaml:"-"`
	Description string `yaml:"description"`
	Service     string `yaml:"service"` // runs inside this service's container...
	Server      string `yaml:"server"`  // ...or on a host
	Command     string `yaml:"command"`
	Interactive bool   `yaml:"interactive"`
}

Command is a user-defined command for `ferry run`.

type Config

type Config struct {
	Name     string              `yaml:"name"`
	Compose  []string            `yaml:"compose"`
	Servers  map[string]*Server  `yaml:"servers"`
	Proxy    Proxy               `yaml:"proxy"`
	Build    Build               `yaml:"build"`
	Registry *Registry           `yaml:"registry"`
	Env      Env                 `yaml:"env"`
	Services map[string]*Service `yaml:"services"`
	Preview  Preview             `yaml:"preview"`
	Hooks    map[HookType]Hook   `yaml:"hooks"`
	Commands map[string]*Command `yaml:"commands"`

	// Dir is the directory containing ferry.yaml; relative paths resolve
	// against it.
	Dir string `yaml:"-"`
}

Config is the parsed ferry.yaml.

func Load

func Load(path string) (*Config, error)

Load reads and parses a ferry.yaml config file.

func (*Config) CommandNames

func (c *Config) CommandNames() []string

CommandNames returns sorted command names.

func (*Config) ContextName

func (c *Config) ContextName(server *Server) string

ContextName returns the Docker context name for a server.

func (*Config) EnvFilesFor

func (c *Config) EnvFilesFor(svc *Service) []string

EnvFilesFor returns the env files (global first, then service overlay) for a service, resolved against the config dir. Missing global file is only an error when explicitly configured.

func (*Config) GetCommand

func (c *Config) GetCommand(name string) (*Command, error)

GetCommand returns a custom command by name.

func (*Config) GetServer

func (c *Config) GetServer(name string) (*Server, error)

GetServer returns a server by name.

func (*Config) GetService

func (c *Config) GetService(name string) (*Service, error)

GetService returns a service overlay by name.

func (*Config) ServerNames

func (c *Config) ServerNames() []string

ServerNames returns sorted server names.

func (*Config) ServiceNames

func (c *Config) ServiceNames() []string

ServiceNames returns sorted service names.

type Env

type Env struct {
	File       string `yaml:"file"`
	Encryption string `yaml:"encryption"` // "none" | "sops-age"
}

Env configures environment delivery.

type Health

type Health struct {
	Path     string `yaml:"path"`
	Interval string `yaml:"interval"`
	Timeout  string `yaml:"timeout"`
}

Health maps to kamal-proxy --health-check-* flags.

type Hook

type Hook []string

Hook is a list of entries; each entry is either a path to a script file or an inline shell command.

type HookType

type HookType string

HookType represents lifecycle hook types

const (
	HookPreBuild    HookType = "pre_build"     // Local, before building
	HookPreDeploy   HookType = "pre_deploy"    // Remote, after image exists on host, before cutover
	HookPostDeploy  HookType = "post_deploy"   // Remote, after cutover
	HookPostAppBoot HookType = "post_app_boot" // Remote, after the proxy reports the target live
)

type Preview

type Preview struct {
	Domain   string   `yaml:"domain"`
	Server   string   `yaml:"server"`
	Services []string `yaml:"services"`
	Isolate  []string `yaml:"isolate"`
	EnvFile  string   `yaml:"env_file"`
	TTL      string   `yaml:"ttl"`
}

Preview configures preview deployments.

func (*Preview) TTLDuration

func (p *Preview) TTLDuration() (time.Duration, error)

TTLDuration parses the TTL; zero means "never".

type Proxy

type Proxy struct {
	Image     string `yaml:"image"`
	Network   string `yaml:"network"`
	HTTPPort  int    `yaml:"http_port"`
	HTTPSPort int    `yaml:"https_port"`
}

Proxy configures kamal-proxy (one container per proxied server).

type Registry

type Registry struct {
	Server   string `yaml:"server"`
	Username string `yaml:"username"`
	Password string `yaml:"password"` // name of a variable in the env file, never a literal
}

Registry configures a registry for build method "pull" with private images.

type Server

type Server struct {
	Name string `yaml:"-"`
	Host string `yaml:"host"`
	User string `yaml:"user"`
	Port int    `yaml:"port"`
}

Server is one target machine. Each server becomes a Docker context named ferry-<name>. SSH auth comes from the system SSH config.

func (*Server) Address

func (s *Server) Address() string

Address returns user@host for SSH.

func (*Server) UnmarshalYAML

func (s *Server) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML accepts both the short form (`vps-1: 1.2.3.4`) and the long form (host/user/port keys).

type Service

type Service struct {
	Name     string            `yaml:"-"`
	Servers  []string          `yaml:"servers"`
	Domain   string            `yaml:"domain"`
	Domains  []string          `yaml:"domains"`
	Port     int               `yaml:"port"`
	Health   Health            `yaml:"health"`
	Proxy    map[string]string `yaml:"proxy"` // passthrough kamal-proxy deploy flags
	EnvFile  string            `yaml:"env_file"`
	Build    string            `yaml:"build"` // per-service override of build.method
	Job      bool              `yaml:"job"`
	Stateful bool              `yaml:"stateful"` // converge in place: stable container, recreated only on config change
}

Service is the ferry.yaml overlay on a compose service. The key must exist in the compose project.

func (*Service) AllDomains

func (s *Service) AllDomains() []string

AllDomains returns domain + domains merged.

Jump to

Keyboard shortcuts

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