deploy

package
v0.0.0-...-09eda65 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContainerNotRunning = errors.New("container is not running")
	ErrContainerTimeout    = errors.New("container is not running (timeout)")
)
View Source
var (
	ErrDeploymentFailed = errors.New("deployment failed")
)

Functions

This section is empty.

Types

type Deployment

type Deployment struct {
	ID             string
	ServicesConfig *config.ServicesConfig
	Events         chan Event
	Manifest       *Manifest
	Logger         *log.Logger
	Subnetter      *docker.Subnetter
}

func NewDeployment

func NewDeployment(servicesConfig *config.ServicesConfig, logger *log.Logger, manager *Manager, subnetter *docker.Subnetter) *Deployment

func (*Deployment) Start

func (d *Deployment) Start() error

type Event

type Event struct {
	Service *service.Service
	Value   any
}

type Manager

type Manager struct {
	Path string
}

Manager contains the path to the manifest file and methods to manage manifests.

func (Manager) Latest

func (m Manager) Latest() (*Manifest, error)

func (Manager) LoadWithID

func (m Manager) LoadWithID(path string) (*Manifest, error)

func (Manager) NewManifest

func (m Manager) NewManifest(id string) *Manifest

func (Manager) Save

func (m Manager) Save(manifest *Manifest) error

type Manifest

type Manifest struct {
	ID         string            `json:"id"`
	Containers map[string]string `json:"containers"`
	Networks   map[string]string `json:"networks"`
}

type Pipeline

type Pipeline struct {
	Docker          *docker.Client
	Deployment      *Deployment
	Service         *service.Service
	HasDependencies bool
}

func (*Pipeline) ConnectRequiredServices

func (d *Pipeline) ConnectRequiredServices(networkID string) error

func (*Pipeline) ContainerName

func (d *Pipeline) ContainerName() string

func (*Pipeline) CreateContainer

func (d *Pipeline) CreateContainer() (string, error)

func (*Pipeline) CreateServiceNetwork

func (d *Pipeline) CreateServiceNetwork() (string, error)

func (*Pipeline) EnsureContainerIsRunning

func (d *Pipeline) EnsureContainerIsRunning(containerID string) error

EnsureContainerIsRunning will wait for the container to start and then return an error if the container is not running after either : - 10 seconds if the container has no health-check - Retries * (Interval + Timeout) if the container has a health-check

todo(pipeline): return logs from failed container

func (*Pipeline) Log

func (d *Pipeline) Log(v any)

func (*Pipeline) PullImage

func (d *Pipeline) PullImage() error

func (Pipeline) Run

func (d Pipeline) Run() error

func (*Pipeline) RunHooks

func (d *Pipeline) RunHooks(containerID string, commands []string) error

func (*Pipeline) StartContainer

func (d *Pipeline) StartContainer(containerID string) error

Jump to

Keyboard shortcuts

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