compose

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// STARTING indicates that stack is being deployed
	STARTING string = "Starting"
	// RUNNING indicates that stack is deployed and services are running
	RUNNING string = "Running"
	// UPDATING indicates that some stack resources are being recreated
	UPDATING string = "Updating"
	// REMOVING indicates that stack is being deleted
	REMOVING string = "Removing"
	// UNKNOWN indicates unknown stack state
	UNKNOWN string = "Unknown"
	// FAILED indicates that stack deployment failed
	FAILED string = "Failed"
)
View Source
const (
	// ProjectTag allow to track resource related to a compose project
	ProjectTag = "com.docker.compose.project"
	// NetworkTag allow to track resource related to a compose network
	NetworkTag = "com.docker.compose.network"
	// ServiceTag allow to track resource related to a compose service
	ServiceTag = "com.docker.compose.service"
	// VolumeTag allow to track resource related to a compose volume
	VolumeTag = "com.docker.compose.volume"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerSummary added in v1.0.5

type ContainerSummary struct {
	ID         string
	Name       string
	Project    string
	Service    string
	State      string
	Publishers []PortPublisher
}

ContainerSummary hold high-level description of a container

type ConvertOptions added in v1.0.6

type ConvertOptions struct {
	// Format define the output format used to dump converted application model (json|yaml)
	Format string
}

ConvertOptions group options of the Convert API

type DownOptions added in v1.0.6

type DownOptions struct {
	// RemoveOrphans will cleanup containers that are not declared on the compose model but own the same labels
	RemoveOrphans bool
}

DownOptions group options of the Down API

type LogConsumer added in v1.0.4

type LogConsumer interface {
	Log(service, container, message string)
}

LogConsumer is a callback to process log messages from services

type LogOptions added in v1.0.6

type LogOptions struct {
	Services []string
}

LogOptions defines optional parameters for the `Log` API

type PortPublisher

type PortPublisher struct {
	URL           string
	TargetPort    int
	PublishedPort int
	Protocol      string
}

PortPublisher hold status about published port

type RunOptions added in v1.0.6

type RunOptions struct {
	Service    string
	Command    []string
	Detach     bool
	AutoRemove bool
	Writer     io.Writer
	Reader     io.Reader
}

RunOptions options to execute compose run

type Service

type Service interface {
	// Build executes the equivalent to a `compose build`
	Build(ctx context.Context, project *types.Project) error
	// Push executes the equivalent ot a `compose push`
	Push(ctx context.Context, project *types.Project) error
	// Pull executes the equivalent of a `compose pull`
	Pull(ctx context.Context, project *types.Project) error
	// Create executes the equivalent to a `compose create`
	Create(ctx context.Context, project *types.Project) error
	// Start executes the equivalent to a `compose start`
	Start(ctx context.Context, project *types.Project, consumer LogConsumer) error
	// Up executes the equivalent to a `compose up`
	Up(ctx context.Context, project *types.Project, options UpOptions) error
	// Down executes the equivalent to a `compose down`
	Down(ctx context.Context, projectName string, options DownOptions) error
	// Logs executes the equivalent to a `compose logs`
	Logs(ctx context.Context, projectName string, consumer LogConsumer, options LogOptions) error
	// Ps executes the equivalent to a `compose ps`
	Ps(ctx context.Context, projectName string) ([]ContainerSummary, error)
	// List executes the equivalent to a `docker stack ls`
	List(ctx context.Context, projectName string) ([]Stack, error)
	// Convert translate compose model into backend's native format
	Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
	// RunOneOffContainer creates a service oneoff container and starts its dependencies
	RunOneOffContainer(ctx context.Context, project *types.Project, opts RunOptions) error
}

Service manages a compose project

type ServiceStatus

type ServiceStatus struct {
	ID         string
	Name       string
	Replicas   int
	Desired    int
	Ports      []string
	Publishers []PortPublisher
}

ServiceStatus hold status about a service

type Stack

type Stack struct {
	ID     string
	Name   string
	Status string
	Reason string
}

Stack holds the name and state of a compose application/stack

type UpOptions added in v1.0.6

type UpOptions struct {
	// Detach will create services and return immediately
	Detach bool
}

UpOptions group options of the Up API

Jump to

Keyboard shortcuts

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