model

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerService

type DockerService interface {
	Setup() error
	Status() (bool, error)
	Start() error
	Stop() error
}

DockerService is the requirements for a Docker container to be compatible. The Service struct is used to implement this interface, and individual variables of type Service can/have overwritten them when logic deems it necessary.

type Network

type Network struct {
	// Name is the name of the network, it is independent of the map key which
	// will be used to configure pygmy but this field should match the map key.
	Name string `yaml:"name"`
	// Containers is a []string which indicates the names of the containers
	// that need to be connected to this network.
	Containers []string `yaml:"containers"`
	// Config is the actual Network configuration for the Docker Network.
	// It is the Network creation configuration as provided by the Docker API.
	Config types.NetworkCreate `yaml:"config"`
}

Network is a struct containing the configuration of a single Docker network including some extra fields so that Pygmy knows how to interact with the desired outcome.

type Params

type Params struct {
	// Domain is the target domain for Pygmy to use.
	Domain string
}

Params is an arbitrary struct to pass around configuration from the top level to the lowest level - such as variable input to one of the containers.

type Service

type Service struct {
	Config        container.Config
	HostConfig    container.HostConfig
	Image         string `yaml:"image"`
	NetworkConfig network.NetworkingConfig
}

Service is a collection of requirements for starting a container and provides a way for config of any container to be overridden and start fully compatible with Docker's API.

func (*Service) Clean

func (Service *Service) Clean() error

Clean will cleanup and remove the container.

func (*Service) Create

func (Service *Service) Create() error

Create will perform a series of checks to see if the container starting is supposed be removed before-hand and will check to see if the container is running before it is actually started.

func (*Service) DockerCreate

func (Service *Service) DockerCreate() error

DockerCreate will setup and run a given container.

func (*Service) DockerLogs

func (Service *Service) DockerLogs() ([]byte, error)

DockerLogs will return the logs from the container.

func (*Service) DockerRun

func (Service *Service) DockerRun() error

DockerRun will start an existing container.

func (*Service) DockerRunInteractive added in v0.12.0

func (Service *Service) DockerRunInteractive() error

DockerRunInteractive will start an interactive container.

func (*Service) GetFieldBool

func (Service *Service) GetFieldBool(field string) (bool, error)

GetFieldBool will get and return a tag on the service using the pygmy convention ("pygmy.*") and return it as a bool.

func (*Service) GetFieldInt

func (Service *Service) GetFieldInt(field string) (int, error)

GetFieldInt will get and return a tag on the service using the pygmy convention ("pygmy.*") and return it as an int.

func (*Service) GetFieldString

func (Service *Service) GetFieldString(field string) (string, error)

GetFieldString will get and return a tag on the service using the pygmy convention ("pygmy.*") and return it as a string.

func (*Service) GetRunning

func (Service *Service) GetRunning() (types.Container, error)

GetRunning will get a types.Container variable for a given running container and it will not retrieve any information on containers that are not running.

func (*Service) Remove

func (Service *Service) Remove() error

Remove will stop the container.

func (*Service) SetField

func (Service *Service) SetField(name string, value interface{}) error

SetField will set a pygmy label to be equal to the string equal of an interface{}, even if it already exists. It should not matter if this container is running or not.

func (*Service) Setup

func (Service *Service) Setup() error

Setup will detect if the Service's image reference exists and will attempt to run `docker pull` on the non-canonical image if it is not found in the daemon.

func (*Service) Start

func (Service *Service) Start() error

Start will perform a series of checks to see if the container starting is supposed be removed before-hand and will check to see if the container is running before it is actually started.

func (*Service) Status

func (Service *Service) Status() (bool, error)

Status will check if the container is running.

func (*Service) Stop

func (Service *Service) Stop() error

Stop will stop the container.

func (*Service) StopAndRemove added in v0.10.0

func (Service *Service) StopAndRemove() error

StopAndRemove will stop and remove the container.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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