ferry

package
v0.0.0-...-528f922 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CleanCmnds = []Role{
	&CleanAppServiceRole{},
}
View Source
var Exec = []Role{
	&ExecDockerCommandRole{},
}
View Source
var RemoveCmnds = []Role{
	&RemoveAppServiceRole{},
}

Functions

func NewSSHClient

func NewSSHClient(server Server) (*ssh.Client, error)

Types

type AttachContainerRole

type AttachContainerRole struct{}

func (*AttachContainerRole) BuildTasks

func (s *AttachContainerRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*AttachContainerRole) Description

func (s *AttachContainerRole) Description() string

type BootstrapAppDirRole

type BootstrapAppDirRole struct{}

func (*BootstrapAppDirRole) BuildTasks

func (s *BootstrapAppDirRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*BootstrapAppDirRole) Description

func (s *BootstrapAppDirRole) Description() string

type BootstrapFerryRole

type BootstrapFerryRole struct{}

func (*BootstrapFerryRole) BuildTasks

func (s *BootstrapFerryRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*BootstrapFerryRole) Description

func (s *BootstrapFerryRole) Description() string

type BuildLocalDockerImageRole

type BuildLocalDockerImageRole struct{}

func (*BuildLocalDockerImageRole) BuildTasks

func (s *BuildLocalDockerImageRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*BuildLocalDockerImageRole) Description

func (s *BuildLocalDockerImageRole) Description() string

type CleanAppServiceRole

type CleanAppServiceRole struct{}

func (*CleanAppServiceRole) BuildTasks

func (s *CleanAppServiceRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*CleanAppServiceRole) Description

func (s *CleanAppServiceRole) Description() string

type CleanUpDeployRole

type CleanUpDeployRole struct{}

func (*CleanUpDeployRole) BuildTasks

func (s *CleanUpDeployRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*CleanUpDeployRole) Description

func (s *CleanUpDeployRole) Description() string

type CommandManager

type CommandManager struct {
	// contains filtered or unexported fields
}

func NewCommandManager

func NewCommandManager(config Config) *CommandManager

func (*CommandManager) Run

func (c *CommandManager) Run(roles []Role) error

type Config

type Config struct {
	DeployMethod  string      `yaml:"deploy_method" default:"pull"`
	Domain        string      `yaml:"domain"`
	CertResolver  string      `yaml:"cert_resolver"`
	Health        HealthCheck `yaml:"health"`
	Image         string      `yaml:"image"`
	Servers       []Server    `yaml:"servers"`
	ContainerName string      `yaml:"container_name" default:"app"`
	EnvFile       string      `yaml:"env_file" default:"./.env"`
	DockerFile    string      `yaml:"docker_file" default:"./Dockerfile"`
	DockerContext string      `yaml:"docker_context" default:"./"`
	Port          int         `yaml:"port" default:"3000"`
	Type          string      `yaml:"type" default:"app"`
	Networks      []string    `yaml:"networks" default:"traefik-public"`
}

type CtxKey

type CtxKey string

type DeployTraefikServiceRole

type DeployTraefikServiceRole struct{}

func (*DeployTraefikServiceRole) BuildTasks

func (s *DeployTraefikServiceRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*DeployTraefikServiceRole) Description

func (s *DeployTraefikServiceRole) Description() string

type ErrorHandler

type ErrorHandler func(ctx context.Context, output []byte, err error) (context.Context, error)

type ExecDockerCommandRole

type ExecDockerCommandRole struct {
	// contains filtered or unexported fields
}

func (*ExecDockerCommandRole) BuildTasks

func (s *ExecDockerCommandRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*ExecDockerCommandRole) Description

func (s *ExecDockerCommandRole) Description() string

type GetContainerNameRole

type GetContainerNameRole struct{}

func (*GetContainerNameRole) BuildTasks

func (s *GetContainerNameRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

Get the container name (either app_name+blue or app_name+green) from the context, using the app_name

func (*GetContainerNameRole) Description

func (s *GetContainerNameRole) Description() string

type HealthCheck

type HealthCheck struct {
	Path              string `yaml:"path" default:"/health"`
	Interval          string `yaml:"interval" default:"30s"`
	Timeout           string `yaml:"timeout" default:"5s"`
	SuccessStatusCode int    `yaml:"success_status_code" default:"200"`
}

type InitTraefikServiceRole

type InitTraefikServiceRole struct{}

func (*InitTraefikServiceRole) BuildTasks

func (s *InitTraefikServiceRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*InitTraefikServiceRole) Description

func (s *InitTraefikServiceRole) Description() string

type InstallDockerRole

type InstallDockerRole struct{}

func (*InstallDockerRole) BuildTasks

func (s *InstallDockerRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*InstallDockerRole) Description

func (s *InstallDockerRole) Description() string

type InstallSopsRole

type InstallSopsRole struct{}

func (*InstallSopsRole) BuildTasks

func (s *InstallSopsRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*InstallSopsRole) Description

func (s *InstallSopsRole) Description() string

type NextIndex

type NextIndex func(ctx context.Context, output []byte, err error) (context.Context, int)

type PrepareDeployRole

type PrepareDeployRole struct{}

func (*PrepareDeployRole) BuildTasks

func (s *PrepareDeployRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*PrepareDeployRole) Description

func (s *PrepareDeployRole) Description() string

type PrepareDockerRole

type PrepareDockerRole struct{}

func (*PrepareDockerRole) BuildTasks

func (s *PrepareDockerRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*PrepareDockerRole) Description

func (s *PrepareDockerRole) Description() string

type PullDockerImageRole

type PullDockerImageRole struct{}

func (*PullDockerImageRole) BuildTasks

func (s *PullDockerImageRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*PullDockerImageRole) Description

func (s *PullDockerImageRole) Description() string

type RemoveAppServiceRole

type RemoveAppServiceRole struct{}

func (*RemoveAppServiceRole) BuildTasks

func (s *RemoveAppServiceRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*RemoveAppServiceRole) Description

func (s *RemoveAppServiceRole) Description() string

type RenewCertificateRole

type RenewCertificateRole struct{}

func (*RenewCertificateRole) BuildTasks

func (s *RenewCertificateRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*RenewCertificateRole) Description

func (s *RenewCertificateRole) Description() string

type ResponseHandler

type ResponseHandler func(ctx context.Context, output []byte) (context.Context, []byte)

type Role

type Role interface {
	BuildTasks(cfg Config, ctx context.Context, server Server) []Task
	Description() string
}

func NewExecDockerCommandRole

func NewExecDockerCommandRole(args []string) []Role

type Server

type Server struct {
	Host    string   `yaml:"host"`
	User    string   `yaml:"user" default:"root"`
	Port    int      `yaml:"port" default:"22"`
	KeyFile string   `yaml:"key_file"`
	AppDir  string   `yaml:"app_dir"`
	Volumes []string `yaml:"volumes"`
}

type ShowDockerLogsRole

type ShowDockerLogsRole struct{}

func (*ShowDockerLogsRole) BuildTasks

func (s *ShowDockerLogsRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*ShowDockerLogsRole) Description

func (s *ShowDockerLogsRole) Description() string

type StopTraefikServiceRole

type StopTraefikServiceRole struct{}

func (*StopTraefikServiceRole) BuildTasks

func (s *StopTraefikServiceRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*StopTraefikServiceRole) Description

func (s *StopTraefikServiceRole) Description() string

type Task

type Task struct {
	// Name is the name of the task. It's used in logs to identify the task.
	Name string
	// Interactive determines if the task should be run in interactive mode.
	Interactive bool
	// The command to run.
	Command string
	// ResponseHandler will determine how the app should react to the command output
	ResponseHandler ResponseHandler
	// ErrorHandler will determine how the app should react to the command error
	ErrorHandler ErrorHandler
	// Remote determines if the task should be run on a remote server or locally.
	Remote bool
	// GetNextTaskIndex is a function that will be called to determine the next task index.
	NextIndex NextIndex

	PipeStdout bool
}

func NewTask

func NewTask(command string) Task

func (Task) IgnoreError

func (t Task) IgnoreError() Task

func (Task) PersistOutput

func (t Task) PersistOutput(name CtxKey) Task

func (Task) SetInteractive

func (t Task) SetInteractive() Task

func (Task) SetRemote

func (t Task) SetRemote(remote bool) Task

func (Task) SkipByOnError

func (t Task) SkipByOnError(increment int) Task

func (Task) SkipByOnOutputMatch

func (t Task) SkipByOnOutputMatch(increment int, match string) Task

func (Task) Stdout

func (t Task) Stdout() Task

func (Task) ThrowDockerErrors

func (t Task) ThrowDockerErrors() Task

func (Task) Wait

func (t Task) Wait(delay int) Task

func (Task) WithErrorHandler

func (t Task) WithErrorHandler(handler ErrorHandler) Task

func (Task) WithResponseHandler

func (t Task) WithResponseHandler(handler ResponseHandler) Task

type UpdateEnvVarsRole

type UpdateEnvVarsRole struct{}

func (*UpdateEnvVarsRole) BuildTasks

func (s *UpdateEnvVarsRole) BuildTasks(cfg Config, ctx context.Context, server Server) []Task

func (*UpdateEnvVarsRole) Description

func (s *UpdateEnvVarsRole) Description() string

type Volume

type Volume struct {
	HostPath      string `yaml:"host_path"`
	ContainerPath string `yaml:"container_path"`
}

Jump to

Keyboard shortcuts

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