Documentation ¶
Overview ¶
A Go package that provides a layer of abstraction above ECS to introduce the concept of Apps, which have are a collection of services.
Index ¶
- Variables
- type App
- type ECSConfig
- type ECSManager
- type Exposure
- type FakeManager
- func (m *FakeManager) Instances(ctx context.Context, appID string) ([]*Instance, error)
- func (m *FakeManager) Remove(ctx context.Context, appID string) error
- func (m *FakeManager) Scale(ctx context.Context, app string, ptype string, instances uint) error
- func (m *FakeManager) Stop(ctx context.Context, instanceID string) error
- func (m *FakeManager) Submit(ctx context.Context, app *App) error
- type Instance
- type LBProcessManager
- type Manager
- type PortMap
- type Process
- type ProcessManager
- type Scaler
Constants ¶
This section is empty.
Variables ¶
var DefaultDelimiter = "-"
var ErrUnsuitableLoadBalancer = errors.New("currently assigned load balancer is not suitable for the given exposure")
Functions ¶
This section is empty.
Types ¶
type ECSConfig ¶
type ECSConfig struct { // The ECS cluster to create services and task definitions in. Cluster string // The IAM role to use for ECS services with ELB's attached. ServiceRole string // VPC controls what subnets to attach to ELB's that are created. VPC string // The hosted zone id to create internal DNS records in ZoneID string // The ID of the security group to assign to internal load balancers. InternalSecurityGroupID string // The ID of the security group to assign to external load balancers. ExternalSecurityGroupID string // The Subnet IDs to assign when creating internal load balancers. InternalSubnetIDs []string // The Subnet IDs to assign when creating external load balancers. ExternalSubnetIDs []string // AWS configuration. AWS *aws.Config }
ECSConfig holds configuration for generating a new ECS backed Manager implementation.
type ECSManager ¶
type ECSManager struct { ProcessManager // contains filtered or unexported fields }
ECSManager is an implementation of the ServiceManager interface that is backed by Amazon ECS.
func NewECSManager ¶
func NewECSManager(config ECSConfig) (*ECSManager, error)
NewECSManager returns a new Manager implementation that:
* Creates services with ECS.
func NewLoadBalancedECSManager ¶
func NewLoadBalancedECSManager(config ECSConfig) (*ECSManager, error)
NewLoadBalancedECSManager returns a new Manager implementation that:
* Creates services with ECS. * Creates internal or external ELB's for ECS services. * Creates a CNAME record in route53 under the internal TLD.
func (*ECSManager) Instances ¶
Instances returns all instances that are currently running, pending or draining.
func (*ECSManager) Remove ¶
func (m *ECSManager) Remove(ctx context.Context, appID string) error
Remove removes any ECS services that belong to this app.
func (*ECSManager) Submit ¶
func (m *ECSManager) Submit(ctx context.Context, app *App) error
Submit will create an ECS service for each individual process in the App. New task definitions will be created based on the information with each process.
If the app was previously submitted with different process than what are provided, any process types that don't exist in the new release will be removed from ECS. For example, if you previously submitted an app with a `web` and `worker` process, then submit an app with the `web` process, the ECS service for the old `worker` process will be removed.
type FakeManager ¶
type FakeManager struct {
// contains filtered or unexported fields
}
func NewFakeManager ¶
func NewFakeManager() *FakeManager
type Instance ¶
type Instance struct { Process *Process // The instance ID. ID string // The State that this Instance is in. State string // The time that this instance was last updated. UpdatedAt time.Time }
Instance represents an Instance of a Process.
type LBProcessManager ¶
type LBProcessManager struct { ProcessManager // contains filtered or unexported fields }
LBProcessManager is an implementation of the ProcessManager interface that creates LoadBalancers when a Process is created.
func (*LBProcessManager) CreateProcess ¶
CreateProcess ensures that there is a load balancer for the process, then creates it. It uses the following algorithm:
* Attempt to find existing load balancer. * If the load balancer exists, check that the exposure is appropriate for the process. * If the load balancer's External attribute doesn't match what we want. Delete the process, also deleting the load balancer. * Create the load balancer * Attach it to the process.
func (*LBProcessManager) RemoveProcess ¶
RemoveProcess removes the process then removes the associated LoadBalancer.
type Manager ¶
type Manager interface { Scaler // Submit submits an app, creating it or updating it as necessary. Submit(context.Context, *App) error // Remove removes the App. Remove(ctx context.Context, app string) error // Instance lists the instances of a Process for an app. Instances(ctx context.Context, app string) ([]*Instance, error) // Stop stops an instance. The scheduler will automatically start a new // instance. Stop(ctx context.Context, instanceID string) error }
Manager is an interface for interfacing with Services.
type Process ¶
type Process struct { // The type of process. Type string // The Image to run. Image string // The Command to run. Command string // Environment variables to set. Env map[string]string // Mapping of host -> container port mappings. Ports []PortMap // Exposure is the level of exposure for this process. Exposure Exposure // Instances is the desired instances of this service to run. Instances uint // The amount of RAM to allocate to this process in bytes. MemoryLimit uint // the --cpu-shares flag for docker. CPUShares uint // A load balancer to attach to the process. LoadBalancer string // An SSL Cert associated with this process. SSLCert string }
type ProcessManager ¶
type ProcessManager interface { Scaler // CreateProcess creates a process for the app. CreateProcess(ctx context.Context, app *App, process *Process) error // RemoveProcess removes a process for the app. RemoveProcess(ctx context.Context, app string, process string) error // Processes returns all processes for the app. Processes(ctx context.Context, app string) ([]*Process, error) }
ProcessManager is a layer level interface than Manager, that provides direct control over individual processes.