mu icon indicating copy to clipboard operation
mu copied to clipboard

Allow LaunchType to be set per service, not per environment.

Open brentley opened this issue 8 years ago • 4 comments

ECS clusters are heterogenous, so it would be cool if we could launch both fargate and ec2 based services into the same cluster. It looks like we export LaunchType from the environment and all services targeting that environment inherit that LaunchType.

If we move this decision into the service definition, then we can decide to launch both types in the same cluster.

brentley avatar Jan 17 '18 21:01 brentley

If the decision is moved to the service definition, then you will always be provisioning ECS container instances (via ASG). Sure, you could set the min/max/desired size of ASG to 0 but still seems clumsy for situations where you only want Fargate...a use case i hope to see more of.

I think it'd be interesting to allow an environment with ec2 launch type to allow a fargate service....but not the other way (Fargate launch type environment with EC2 service).

Does that seem correct?

cplee avatar Jan 18 '18 02:01 cplee

Yeah, that sounds right... the use case you mentioned is exactly the situation I found myself in... I have a cluster running EC2 type services, and wanted to convert it to fargate. The easy way would be to convert service-by-service, but that doesn't appear to be possible. Trying to convert the whole environment caused an error (if I remember correctly).

It's an interesting scenario... maybe we need both options? To set the environment to a specific type, then also allow service-by-service overrides?

brentley avatar Jan 18 '18 16:01 brentley

So I've built a cluster using the default EC2 instances, and want to add a new service running on fargate.

At the top of mu.yml if I describe the provider to be ecs-fargate why can't we generate the fargate compatible task def and deploy a fargate service definition to the target cluster?

I don't see why that would need to touch any of the instance ASG settings.

Thoughts?

---
environments:
  - name: acceptance
    provider: ecs-fargate
  - name: production
    provider: ecs-fargate
service:
  desiredCount: 3
  maxSize: 6
  port: 3000
...

(btw, this doesn't work, but is just an example of what I imagine should be easy to make work)

brentley avatar Apr 18 '18 14:04 brentley

This would work fine, but i'd suggest using different environments (one set for Fargate and another for EC2).

cplee avatar Apr 20 '18 21:04 cplee