ecs

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2016 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Overview

Pacakge ecs provides an implementation of the Scheduler interface that uses Amazon EC2 Container Service.

Index

Constants

View Source
const ContainerPort = 8080

For HTTP/HTTPS/TCP services, we allocate an ELB and map it's instance port to the container port. This is the port that processes within the container should bind to. Tihs value is also exposed to the container through the PORT environment variable.

Variables

View Source
var DefaultDelimiter = "-"

Functions

This section is empty.

Types

type Config

type Config struct {
	// The ECS cluster to create services and task definitions in.
	Cluster string

	// The IAM role to use for ECS services with ELBs attached.
	ServiceRole string

	// VPC controls what subnets to attach to ELBs 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 client.ConfigProvider

	// Log configuraton for ECS tasks
	LogConfiguration *ecs.LogConfiguration
}

Config holds configuration for generating a new ECS backed Scheduler implementation.

type LoadBalancerExposureError

type LoadBalancerExposureError struct {
	// contains filtered or unexported fields
}

LoadBalancerExposureError is returned when the exposure of the process in the data store does not match the exposure of the ELB

func (*LoadBalancerExposureError) Error

func (e *LoadBalancerExposureError) Error() string

type RemoveOptions added in v0.10.1

type RemoveOptions struct {
	// If set to true, DNS records will not be removed.
	NoDNS bool
}

RemoveOptions are options that can be passed to RemoveWithOptions.

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler is an implementation of the ServiceManager interface that is backed by Amazon ECS.

func NewLoadBalancedScheduler

func NewLoadBalancedScheduler(db *sql.DB, config Config) (*Scheduler, error)

NewLoadBalancedScheduler returns a new Scheduler instance that:

* Creates services with ECS. * Creates internal or external ELBs for ECS services. * Creates a CNAME record in route53 under the internal TLD. * Allocates ports from the ports table.

func NewScheduler

func NewScheduler(config Config) (*Scheduler, error)

NewScheduler returns a new Scheduler implementation that:

* Creates services with ECS.

func (*Scheduler) CreateProcess added in v0.10.1

func (m *Scheduler) CreateProcess(ctx context.Context, app *scheduler.App, p *scheduler.Process) error

CreateProcess creates an ECS service for the process.

func (*Scheduler) Instances

func (m *Scheduler) Instances(ctx context.Context, appID string) ([]*scheduler.Instance, error)

Instances returns all instances that are currently running, pending or draining.

func (*Scheduler) Processes added in v0.10.1

func (m *Scheduler) Processes(ctx context.Context, appID string) ([]*scheduler.Process, error)

func (*Scheduler) Remove

func (m *Scheduler) Remove(ctx context.Context, appID string) error

Remove removes all of the AWS resources for this app.

func (*Scheduler) RemoveCNAMEs added in v0.10.1

func (m *Scheduler) RemoveCNAMEs(ctx context.Context, appID string) error

This is purely used to migrate to the new CloudFormation scheduler. Simply deletes the existing CNAME record for the app, so that the CloudFormation stack can create it.

func (*Scheduler) RemoveProcess added in v0.10.1

func (m *Scheduler) RemoveProcess(ctx context.Context, app string, process string) error

func (*Scheduler) RemoveWithOptions added in v0.10.1

func (m *Scheduler) RemoveWithOptions(ctx context.Context, appID string, opts RemoveOptions) error

RemoveWithOptions removes the application.

func (*Scheduler) Restart added in v0.11.0

func (m *Scheduler) Restart(ctx context.Context, app *scheduler.App, ss scheduler.StatusStream) error

Restart restarts all of the processes for the app.

func (*Scheduler) Run added in v0.10.1

func (m *Scheduler) Run(ctx context.Context, app *scheduler.App, process *scheduler.Process, in io.Reader, out io.Writer) error

func (*Scheduler) Stop

func (m *Scheduler) Stop(ctx context.Context, instanceID string) error

func (*Scheduler) Submit

func (m *Scheduler) Submit(ctx context.Context, app *scheduler.App, ss scheduler.StatusStream) 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.

Directories

Path Synopsis
package lb provides an abstraction around creating load balancers.
package lb provides an abstraction around creating load balancers.

Jump to

Keyboard shortcuts

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