Documentation ¶
Index ¶
- Variables
- type Config
- type Docker
- func (d Docker) AllPurge(deleteGlobalVolumes bool) error
- func (d Docker) AllStatus() ([]Status, error)
- func (d Docker) AllStop() error
- func (d Docker) ContainerCommand(id string, user string, cmd []string, out io.Writer) (int, error)
- func (d Docker) ContainerCommit(id string) error
- func (d Docker) ContainerDeleteCommit(id string) error
- func (d Docker) ContainerDownload(id string, path string, w io.Writer) error
- func (d Docker) ContainerLog(id string, follow bool) (io.ReadCloser, error)
- func (d Docker) ContainerShell(id string, user string, cmd []string, stdin io.Reader) (int, error)
- func (d Docker) ContainerStart(c Config) error
- func (d Docker) ContainerStatus(id string) (Status, error)
- func (d Docker) ContainerUpload(id string, path string, r io.Reader) error
- func (d Docker) ImagePull(c []Config) error
- func (d Docker) ProjectCopySlot(pid string, sourceSlot int, destSlot int) error
- func (d Docker) ProjectPurge(pid string) error
- func (d Docker) ProjectPurgeSlot(pid string, slot int) error
- func (d Docker) ProjectStop(pid string) error
- type Dummy
- func (d Dummy) AllPurge(deleteGlobalVolumes bool) error
- func (d Dummy) AllStatus() ([]Status, error)
- func (d Dummy) AllStop() error
- func (d Dummy) ContainerCommand(id string, user string, cmd []string, out io.Writer) (int, error)
- func (d Dummy) ContainerCommit(id string) error
- func (d Dummy) ContainerDeleteCommit(id string) error
- func (d Dummy) ContainerDownload(id string, path string, w io.Writer) error
- func (d Dummy) ContainerLog(id string, follow bool) (io.ReadCloser, error)
- func (d Dummy) ContainerShell(id string, user string, cmd []string, stdin io.Reader) (int, error)
- func (d Dummy) ContainerStart(c Config) error
- func (d Dummy) ContainerStatus(id string) (Status, error)
- func (d Dummy) ContainerUpload(id string, path string, r io.Reader) error
- func (d Dummy) GetContainer(id string) *DummyContainer
- func (d Dummy) HasVolume(id string) bool
- func (d Dummy) ImagePull(c []Config) error
- func (d Dummy) ProjectCopySlot(pid string, sourceSlot int, destSlot int) error
- func (d Dummy) ProjectPurge(pid string) error
- func (d Dummy) ProjectPurgeSlot(pid string, slot int) error
- func (d Dummy) ProjectStop(pid string) error
- type DummyContainer
- type DummyTracker
- type Interface
- type ObjectContainerType
- type Status
Constants ¶
This section is empty.
Variables ¶
var ( // ErrContainerNotFound is an error returned when a container is not found. ErrContainerNotFound = errors.New("container not found") // ErrContainerNotRunning is an error returned when a container is not running. ErrContainerNotRunning = errors.New("container is not running") // ErrCannotDeleteCommit is an error returned when a container commit cannot be deleted. ErrCannotDeleteCommit = errors.New("cannot delete commit") // ErrImageNotFound is an error returned when a container image is not found. ErrImageNotFound = errors.New("image not found") // ErrInvalidSlot is an error returned when an invalid slot is specified. ErrInvalidSlot = errors.New("invalid slot") // ErrCommandExited is an error returned when a container command exits with a non zero exit code. ErrCommandExited = errors.New("command exited with error") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ProjectID string Slot int // set the slot to use for mount volumes NoCommit bool // when true don't use committed app image ObjectType ObjectContainerType ObjectName string Command []string Images []string Volumes map[string]string Binds map[string]string Env map[string]string Ports []string WorkingDir string EnableOSXNFS bool }
Config contains configuration for a Docker container.
func (Config) GetCommand ¶
GetCommand returns the container command.
func (Config) GetContainerName ¶
GetContainerName return the name of the Docker container.
func (Config) GetHumanName ¶
GetHumanName returns human readable container name.
func (Config) GetNetworkName ¶
GetNetworkName returns the name of the Docker network.
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
Docker defines the Docker container handler.
func (Docker) ContainerCommand ¶
ContainerCommand runs a command inside a Docker container.
func (Docker) ContainerCommit ¶
ContainerCommit stores a Docker container's state as an image.
func (Docker) ContainerDeleteCommit ¶
ContainerDeleteCommit deletes Docker image for given container.
func (Docker) ContainerDownload ¶
ContainerDownload downloads one or more files from container and write to writer as tarball.
func (Docker) ContainerLog ¶
ContainerLog returns a reader containing log data for a Docker container.
func (Docker) ContainerShell ¶
ContainerShell creates an interactive shell in given container.
func (Docker) ContainerStart ¶
ContainerStart starts a Docker container.
func (Docker) ContainerStatus ¶
ContainerStatus returns status of Docker container.
func (Docker) ContainerUpload ¶
ContainerUpload uploads one or more files to a Docker container from a tarball reader.
func (Docker) ProjectCopySlot ¶
ProjectCopySlot copies volumes in given slot to another slot.
func (Docker) ProjectPurge ¶
ProjectPurge deletes all Docker resources for given project.
func (Docker) ProjectPurgeSlot ¶
ProjectPurgeSlot deletes all Docker resources for given project slot.
func (Docker) ProjectStop ¶
ProjectStop stops all running Docker containers for given project.
type Dummy ¶
type Dummy struct {
Tracker *DummyTracker
}
Dummy defines the dummy container handler.
func (Dummy) ContainerCommand ¶
ContainerCommand runs dummy command.
func (Dummy) ContainerCommit ¶
ContainerCommit commits dummy container.
func (Dummy) ContainerDeleteCommit ¶
ContainerDeleteCommit deletes dummy commit.
func (Dummy) ContainerDownload ¶
ContainerDownload uploads to dummy container.
func (Dummy) ContainerLog ¶
ContainerLog returns dummy logs.
func (Dummy) ContainerShell ¶
ContainerShell runs dummy shell.
func (Dummy) ContainerStart ¶
ContainerStart starts dummy container.
func (Dummy) ContainerStatus ¶
ContainerStatus gets dummy status.
func (Dummy) ContainerUpload ¶
ContainerUpload uploads to dummy container.
func (Dummy) GetContainer ¶
func (d Dummy) GetContainer(id string) *DummyContainer
GetContainer returns the dummy container for given ID.
func (Dummy) ProjectCopySlot ¶
ProjectCopySlot copy dummy slots.
func (Dummy) ProjectPurge ¶
ProjectPurge purges dummy resources.
func (Dummy) ProjectPurgeSlot ¶
ProjectPurgeSlot purges dummy project slot.
func (Dummy) ProjectStop ¶
ProjectStop stops dummy containers.
type DummyContainer ¶
type DummyContainer struct { ID string Config Config Committed bool Running bool CommandHistory []string Uploads []string }
DummyContainer is a dummy container.
func (DummyContainer) CommandHistoryIndex ¶
func (d DummyContainer) CommandHistoryIndex(v string) int
CommandHistoryIndex returns command history index of command that contains given string.
func (DummyContainer) HasUpload ¶
func (d DummyContainer) HasUpload(path string) bool
HasUpload returns true if upload was run at given path.
type DummyTracker ¶
type DummyTracker struct { Volumes []string Containers []*DummyContainer Sync sync.Mutex }
DummyTracker track the status of the dummy container environment.
type Interface ¶
type Interface interface { ContainerStart(c Config) error ContainerCommand(id string, user string, cmd []string, out io.Writer) (int, error) ContainerShell(id string, user string, cmd []string, stdin io.Reader) (int, error) ContainerStatus(id string) (Status, error) ContainerUpload(id string, path string, r io.Reader) error ContainerDownload(id string, path string, w io.Writer) error ContainerLog(id string, follow bool) (io.ReadCloser, error) ContainerCommit(id string) error ContainerDeleteCommit(id string) error ImagePull(c []Config) error ProjectStop(pid string) error ProjectPurge(pid string) error ProjectPurgeSlot(pid string, slot int) error ProjectCopySlot(pid string, sourceSlot int, destSlot int) error AllStop() error AllPurge(deleteGlobalVolumes bool) error AllStatus() ([]Status, error) }
Interface defines methods used to interact with container.
type ObjectContainerType ¶
type ObjectContainerType byte
ObjectContainerType defines the type of container.
const ( // ObjectContainerNone is an unknown container. ObjectContainerNone ObjectContainerType = '-' // ObjectContainerApp is an application container. ObjectContainerApp ObjectContainerType = 'a' // ObjectContainerWorker is a worker container. ObjectContainerWorker ObjectContainerType = 'w' // ObjectContainerService is a service container. ObjectContainerService ObjectContainerType = 's' // ObjectContainerRouter is the router container. ObjectContainerRouter ObjectContainerType = 'r' )
func (ObjectContainerType) TypeName ¶
func (o ObjectContainerType) TypeName() string
TypeName gets the type of container as a string.
type Status ¶
type Status struct { ID string `json:"id"` Name string `json:"name"` ObjectType ObjectContainerType `json:"object_type"` Image string `json:"image"` Type string `json:"type"` ProjectID string `json:"project_id"` Committed bool `json:"committed"` Running bool `json:"running"` State string `json:"state"` IPAddress string `json:"ip_address"` Slot int `json:"slot"` HasContainer bool `json:"has_container"` }
Status defines container status.