containers-roadmap icon indicating copy to clipboard operation
containers-roadmap copied to clipboard

[ECS] [request]: Support Cross Service Cross Task Definition Dependency

Open e-moshaya opened this issue 6 years ago • 13 comments

Tell us about your request What do you want us to build? Support Cross Service Cross Task Definition Dependency

Which service(s) is this request for? Fargate, ECS

Based on aws documentation https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html,

"Your entire application stack does not need to exist on a single task definition, and in most cases it should not. Your application can span multiple task definitions by combining related containers into their own task definitions, each representing a single component"

This means that it is best practice to separate each component/service into its own task definition. However, cross task definition is not yet supported. Only container dependencies within a single task definition is supported. This needs extending to support cross service.

e-moshaya avatar Sep 16 '19 14:09 e-moshaya

Can you explain more about your use case? Do you want to have services that start up and shut down in a certain order? Or something else? The more detail you can provide, the better we can evaluate and prioritize.
Thanks for your feedback!

coultn avatar Sep 20 '19 18:09 coultn

+1 for this.

As you said @coultn we would like to prioritize startup order of different services which can run into issues if a certain service starts before the other (currently random). This has come up basically as a result of starting and stopping the ECS cluster overnight for cost saving reasons.

e-power avatar Nov 12 '19 13:11 e-power

Need this to run Apollo GraphQL Federated Schema. In short, there is a Gateway that polls child schemas (Fargate services) on startup to compile a single schema. The Gateway must spawn after all child services are up. Otherwise it won't contain parts of schema that were spawned after it.

vsnig avatar Jan 19 '20 19:01 vsnig

We have daemon services of datadog-agent on ECS EC2 clusters. As the agent task collects metrics and logs from other tasks on an EC2 instance, it should start before (and stop after) any other tasks when an EC2 instance is initializing (and draining). It would be achieved if we can define the dependency between services.

kamatama41 avatar Nov 12 '20 20:11 kamatama41

K8s has initContainers pattern. Looks like this can be done with Container Depdencies in ECS.

mooreniemi avatar Jun 01 '21 19:06 mooreniemi

HI all! Is there any findings around this ticket? Our use case is we want to run a setup task before we spin up our tasks in ECS, the problem is, this setup task should be run only once even if we want to spin up more than one task for our application. I've checked the Container Dependencies in ECS and this doesn't work as it will run the initial container for each instance of our app. As far as I understand the purpose of the ticket is how to make sure independent tasks can depend on each other at the service level and not at the container level

afdecastro879 avatar Apr 11 '22 08:04 afdecastro879

+1 vote for this feature. Use case is a Rails app, running a task to completes db:migrate first, then running the app server after migrations have completed.

sjohnsonsf avatar Oct 29 '22 00:10 sjohnsonsf

+1 vote for this feature. Use case is a php app, first the db migration task needs to run once and then php app should execute after migrations have completed successfully.

jas550 avatar Apr 12 '23 21:04 jas550

+1 for the same reason as @afdecastro879

HI all! Is there any findings around this ticket? Our use case is we want to run a setup task before we spin up our tasks in ECS, the problem is, this setup task should be run only once even if we want to spin up more than one task for our application. I've checked the Container Dependencies in ECS and this doesn't work as it will run the initial container for each instance of our app. As far as I understand the purpose of the ticket is how to make sure independent tasks can depend on each other at the service level and not at the container level

eeepmb avatar Jun 23 '23 12:06 eeepmb

This is also important when you add in the fact that ECS has a limit on task definition size (65536 bytes). This means that even if you tried to put in your application within one task (to use the DependsOn from task definition), it quickly becomes impossible because you hit the size limit.

pbudzon avatar Jun 29 '23 08:06 pbudzon

+1, this issue has been open for about 5 years now and I'm shocked it isn't natively supported in ECS. For my use case, I have a postgres and redis database that need to be deployed first and then my dependent services afterwards. Currently when cold-starting all services in a cluster via EC2, the API and consumer tasks hog available space on my larger instance. This means that I can't utilize the full space on that instance for redis/postgres and need to micromanage task startups until the database tasks start on the right instance.

TreehouseFalcon avatar Mar 14 '24 01:03 TreehouseFalcon

+1 Here. I have a service container that other containers need to connect to, but are not directly part of that core service. Using DependsOn seems to only work internally in the same service/task, not to other services. Adding an option to Depend on a service would be great, with the same condition options as DependsOn.

steven-geo avatar Jul 19 '24 06:07 steven-geo

+1

alandreasyans avatar Sep 09 '24 13:09 alandreasyans

+1

Parth2404 avatar Dec 29 '24 04:12 Parth2404