service

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Unlicense Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Logdir string `json:"logdir"`

	// Network is the ID of the Network that the Services run on
	Network string `json:"network"`

	// Services is a list of Services that the manager manages
	Services map[string]*Service `json:"services"`
	// contains filtered or unexported fields
}

func New

func New(docker *client.Client, log *log.Entry, logdir string) *Manager

New creates a new service manager

func (*Manager) EnsureService

func (m *Manager) EnsureService(ctx context.Context, s *Service) error

EnsureService adds a service to the manager if it does not exist, and starts it, waiting for it to be healthy

func (*Manager) ListContainers

func (m *Manager) ListContainers(ctx context.Context) ([]types.Container, error)

ListContainers lists all containers from the manager

func (*Manager) RunCommand

func (m *Manager) RunCommand(ctx context.Context, server *Service, cmd []string) error

type Service

type Service struct {

	// Name is the name of the service
	Name string `json:"name"`

	// Image is the docker image that the service runs
	Image string `json:"image"`

	// Mounts is a list of volumes that the service mounts
	Mounts []mount.Mount `json:"mounts"`

	// Env is a list of environment variables that the service uses
	Env []string `json:"env"`

	// Ports is a list of ports that the service exposes
	PortBindings map[nat.Port][]nat.PortBinding `json:"port_bindings"`

	// ExposedPorts is a list of ports that the service exposes
	ExposedPorts nat.PortSet `json:"exposed_ports"`

	// Command is the command that the service runs
	Entrypoint []string `json:"entrypoint"`
	// contains filtered or unexported fields
}

Service is a docker container, that runs part of the application

func (*Service) GetHash

func (s *Service) GetHash() string

GetHash returns a hash of the service configuration

func (*Service) GetName

func (s *Service) GetName() string

GetName returns the name of the service

Jump to

Keyboard shortcuts

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