compose

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder() *Builder

func (*Builder) AddNetwork added in v1.0.3

func (b *Builder) AddNetwork(n *Network) *Builder

func (*Builder) AddService

func (b *Builder) AddService(s ServiceBuilder) *Builder

func (*Builder) Build

func (b *Builder) Build() (*Compose, error)

func (*Builder) MustBuild

func (b *Builder) MustBuild() *Compose

type Compose

type Compose struct {
	Path     string              `yaml:"-"`
	Version  string              `yaml:"version"`
	Services map[string]*Service `yaml:"services,omitempty"`
	Networks map[string]*Network `yaml:"networks,omitempty"`
}

func (*Compose) Run

func (c *Compose) Run(callback func() error, preserve bool) error

type HealthCheck

type HealthCheck struct {
	Test []string `yaml:"test,omitempty"`
	// Interval between two health checks, the default is 30 seconds.
	Interval time.Duration `yaml:"interval,omitempty"`
	// The health check command runs the timeout period.
	// If this time is exceeded, the health check is regarded as a failure.
	Timeout time.Duration `yaml:"timeout,omitempty"`
	// When the specified number of consecutive failures, the container status is treated as unhealthy, the default is 3 times.
	Retries uint `yaml:"retries,omitempty"`
	// The number of seconds to start the health check after the container starts, the default is 0 seconds.
	StartPeriod time.Duration `yaml:"start_period,omitempty"`
}

type IPAM added in v1.0.3

type IPAM struct {
	Config []IPAMConfig `yaml:"config"`
}

func (*IPAM) Validate added in v1.0.3

func (i *IPAM) Validate() error

type IPAMConfig added in v1.0.3

type IPAMConfig struct {
	Subnet  string `yaml:"subnet"`
	Gateway string `yaml:"gateway"`
	IPRange string `yaml:"ip_range"`
}

func (*IPAMConfig) Validate added in v1.0.3

func (c *IPAMConfig) Validate() error

type Network added in v1.0.3

type Network struct {
	Name   string `yaml:"name"`
	Driver string `yaml:"driver"`
	IPAM   IPAM   `yaml:"ipam"`
}

func (*Network) Validate added in v1.0.3

func (n *Network) Validate() error

type Service

type Service struct {
	Name        string                    `yaml:"-"`
	Image       string                    `yaml:"image,omitempty"`
	Command     string                    `yaml:"command,omitempty"`
	Environment map[string]string         `yaml:"environment,omitempty"`
	Ports       []string                  `yaml:"ports,omitempty"`
	Volumes     []string                  `yaml:"volumes,omitempty"`
	HealthCheck *HealthCheck              `yaml:"healthcheck,omitempty"`
	Network     map[string]ServiceNetwork `yaml:"networks,omitempty"`
	Privileged  bool                      `yaml:"privileged,omitempty"`
}

func (*Service) Service

func (s *Service) Service() *Service

func (*Service) Validate

func (s *Service) Validate() error

type ServiceBuilder

type ServiceBuilder interface {
	Service() *Service
}

type ServiceNetwork added in v1.0.3

type ServiceNetwork struct {
	IPv4 string `yaml:"ipv4_address,omitempty"`
}

Jump to

Keyboard shortcuts

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