service

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingService = errors.New("missing service")
)

Functions

This section is empty.

Types

type EnvMap

type EnvMap map[string]string

func (EnvMap) ForDocker

func (e EnvMap) ForDocker() []string

type Hooks

type Hooks struct {
	// Prestart is a list of commands to run before the service starts.
	Prestart []string `yaml:"prestart" json:"prestart"`
	// Poststart is a list of commands to run after the service starts.
	Poststart []string `yaml:"poststart" json:"poststart"`
	// Preclean is a list of commands to run before the service is removed by the container collector.
	Preclean []string `yaml:"preclean" json:"preclean"`
	// Postclean is a list of commands to run after the service is removed by the container collector.
	Postclean []string `yaml:"postclean" json:"postclean"`
}

func (*Hooks) MarshalJSON

func (h *Hooks) MarshalJSON() ([]byte, error)

type Node

type Node struct {
	Parent  *Node
	Service *Service
	Edges   []*Node
	Depth   int
}

func (*Node) AddEdge

func (n *Node) AddEdge(e *Node)

func (*Node) Walk

func (n *Node) Walk(f func(n *Node))

type Service

type Service struct {
	// Name of the service.
	Name string `yaml:"-" json:"-"`
	// Include is the path to a file containing the service config.
	Include string `yaml:"include" json:"include"`

	// Image name without a registry.
	Image string `yaml:"image" json:"image"`

	// Hosts the service responds to.
	Hosts []string `yaml:"hosts" json:"hosts"`

	// Env variables for the service.
	Env EnvMap `yaml:"env" json:"env"`

	// ListeningOn is the port the service listens on.
	ListeningOn string `yaml:"listening_on" json:"listeningOn"`

	// Hooks are commands to run during the lifecycle of the service.
	Hooks Hooks `yaml:"hooks" json:"hooks"`

	// Requires is a list of services that must be running before this service.
	Requires []string `yaml:"requires" json:"requires"`

	// Registry to pull the image from.
	// It may be a string referencing Retrieve.Registries[%s] or a Registry.
	Registry string `yaml:"registry" json:"registry"`
}

Service contains the information about a service.

func (*Service) ApplyDefaults

func (s *Service) ApplyDefaults(serviceName string)

ApplyDefaults sets default values and transforms certain defined patterns of a unmarshalled service.

func (*Service) MarshalJSON

func (s *Service) MarshalJSON() ([]byte, error)

type ServiceMap

type ServiceMap map[string]*Service

func (ServiceMap) GroupInLayers

func (s ServiceMap) GroupInLayers() ([][]*Service, error)

func (ServiceMap) NewGraph

func (s ServiceMap) NewGraph() (*Node, error)

func (*ServiceMap) UnmarshalYAML

func (s *ServiceMap) UnmarshalYAML(unmarshal func(any) error) error

Jump to

Keyboard shortcuts

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