Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorEmptyHistory = errors.New("container history is empty")
var ErrorLaunchConfigNotFound = fmt.Errorf("launch configuration not found")
Functions ¶
This section is empty.
Types ¶
type ContainerHistory ¶
type ContainerHistory struct { Events []*ContainerHistoryEvent MaxSize int // contains filtered or unexported fields }
A datastructure to manage the most recent containers that are/have been deployed. Including pointers to the launch configurations that were used for them.
func LoadContainerHistory ¶
func LoadContainerHistory(s3c *s3.Client, bucket, prefix string) (*ContainerHistory, error)
Load the container history from S3.
func (*ContainerHistory) Add ¶
func (ch *ContainerHistory) Add(lc *LaunchConfig) (*ContainerHistoryEvent, error)
Add a new entry to the history. This will add a new launch configuration and persist the launch configuration itself to S3. After a successful deployment (not part of this package) the changed history should be persisted, so that rollback and restart can rely on the current information.
func (*ContainerHistory) RollbackTo ¶
func (ch *ContainerHistory) RollbackTo(che *ContainerHistoryEvent) (*ContainerHistoryEvent, error)
Rollback to the container in the given history event. The history is changed to only contain events up to the given one, i.e. all successors are removed. Please note an explicit history.Save call must be done to persist the changed history.
func (*ContainerHistory) Save ¶
func (ch *ContainerHistory) Save() error
Persist the container history to S3.
type ContainerHistoryEvent ¶
type ContainerHistoryEvent struct { Revision string DeployedAt time.Time DeployedBy string Hash string // contains filtered or unexported fields }
func (*ContainerHistoryEvent) Load ¶
func (che *ContainerHistoryEvent) Load() (*LaunchConfig, error)
Load the event's container configuration from S3.
type ContainerManager ¶
type ContainerManager struct { S3Bucket string S3Prefix string Proxy *Proxy RegistryPort int AppName string // contains filtered or unexported fields }
func NewContainerManager ¶
func (*ContainerManager) StartContainer ¶
func (cm *ContainerManager) StartContainer(hash string) (string, int, error)
func (*ContainerManager) Stats ¶
func (cm *ContainerManager) Stats(stats map[string]interface{}) error
func (*ContainerManager) StopOldContainers ¶
func (cm *ContainerManager) StopOldContainers() error
func (*ContainerManager) SwitchContainer ¶
func (cm *ContainerManager) SwitchContainer(hash string) (string, int, error)
type LaunchConfig ¶
type LaunchConfig struct { ContainerConfig *docker.ContainerConfig HostConfig *docker.HostConfig HealthCheckPath string Revision string ForceReload bool // contains filtered or unexported fields }
The launch configuration contains all the information required to start a container with the required environment, including all the environment variables required (like credentials).
func LoadCurrentLaunchConfig ¶
func LoadCurrentLaunchConfig(s3c *s3.Client, bucket, prefix string) (*LaunchConfig, error)
Function to load the currently deployed container for the environment specified in the prefix. If history is empty the ErrorLaunchConfigNotFound error type will be returned.
func LoadLaunchConfig ¶
func LoadLaunchConfig(s3c *s3.Client, bucket, prefix, hash string) (*LaunchConfig, error)
Function to load a given launch configuration from S3. This must be a public method to be able to load it when first deploying it (its not part of the history right then).