Documentation ¶
Overview ¶
Pacakge ecs provides an implementation of the Scheduler interface that uses Amazon EC2 Container Service.
Index ¶
- Constants
- Variables
- type Config
- type LoadBalancerExposureError
- type RemoveOptions
- type Scheduler
- func (m *Scheduler) CreateProcess(ctx context.Context, app *scheduler.App, p *scheduler.Process) error
- func (m *Scheduler) Instances(ctx context.Context, appID string) ([]*scheduler.Instance, error)
- func (m *Scheduler) Processes(ctx context.Context, appID string) ([]*scheduler.Process, error)
- func (m *Scheduler) Remove(ctx context.Context, appID string) error
- func (m *Scheduler) RemoveCNAMEs(ctx context.Context, appID string) error
- func (m *Scheduler) RemoveProcess(ctx context.Context, app string, process string) error
- func (m *Scheduler) RemoveWithOptions(ctx context.Context, appID string, opts RemoveOptions) error
- func (m *Scheduler) Restart(ctx context.Context, app *scheduler.App, ss scheduler.StatusStream) error
- func (m *Scheduler) Run(ctx context.Context, app *scheduler.App, process *scheduler.Process, ...) error
- func (m *Scheduler) Stop(ctx context.Context, instanceID string) error
- func (m *Scheduler) Submit(ctx context.Context, app *scheduler.App, ss scheduler.StatusStream) error
Constants ¶
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 ¶
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 ¶
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 ¶
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 ¶
Instances returns all instances that are currently running, pending or draining.
func (*Scheduler) RemoveCNAMEs ¶ added in v0.10.1
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 (*Scheduler) RemoveWithOptions ¶ added in v0.10.1
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) 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.