Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WaitFor(...): Resource startup sequencing with dependencies #5275

Closed
mitchdenny opened this issue Aug 13, 2024 · 12 comments
Closed

WaitFor(...): Resource startup sequencing with dependencies #5275

mitchdenny opened this issue Aug 13, 2024 · 12 comments
Assignees
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Milestone

Comments

@mitchdenny
Copy link
Member

The purpose of this issue is to bring together the various threads/issues/discussions about a new API that we want to add to the .NET Aspire AppHost/AppModel that allows developers to express startup dependencies between resources. The most recent spike/prototype of this feature was by @davidfowl here:

https://github.com/davidfowl/WaitForDependenciesAspire/blob/389f02daf2a3903924875c601dc300371aa99e27/WaitForDependencies.AppHost/Program.cs#L19

This issue is not a formal API proposal (we'll create one of those separately). But the high level of the API is this:

public class ResourceBuilderExtensions
{
+ public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> other) where T : IResource
}

This would create a new annotation in the app model which mechanisms like the ApplicationExecutor (internal) would honor (@davidfowl's prototype exploits environment callbacks so we would be shifting to something more explicit).

David's prototype also has a WaitForCompletion(...) method and we are also experimenting with WaitForText(...) APIs in some of our internal testing code which are also good candidates for inclusion in this overall feature.

Finally, we may want this feature to integrate in some way with health checks so that WaitFor(...) ... when health checks are present waits for the checks to become healthy before allowing the dependent resource to start up.

@mitchdenny mitchdenny added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Aug 13, 2024
@mitchdenny mitchdenny added this to the 8.2 milestone Aug 13, 2024
@mitchdenny mitchdenny self-assigned this Aug 13, 2024
@mitchdenny
Copy link
Member Author

Note that this feature may not ship in 8.2 - work will be done in 8.2 but it probably won't be complete.

@mitchdenny mitchdenny changed the title WaitFor(...): Resource startup sequencing with dependenies WaitFor(...): Resource startup sequencing with dependencies Aug 13, 2024
@mitchdenny
Copy link
Member Author

There may be some interaction between what we want to do here and #5234 (issue) #5223 (PR).

@joperezr
Copy link
Member

@mitchdenny I'm assuming this is not going to make it into 8.2 (meaning it is not blocking)

@joperezr joperezr modified the milestones: 8.2, 9.0 Aug 19, 2024
@mitchdenny
Copy link
Member Author

Not blocking. But we probably want this in for 8.2: #5359

@JeroMiya
Copy link

The milestone was updated to 9.0 - does that mean it's not going to make it into a LTS version of .NET until Q4 2025? Can we get a backport of the feature for .net 8.0? Many companies have a "LTS only" policy and this feature is a major blocker.

@mitchdenny
Copy link
Member Author

That is the current plan. As we got into this we realized that WaitFor(...) really needs to perform some kind of health check on the resource that was deployed to ensure that its actually available to handle traffic (not just that it merely started).

That means that we need to add health check mechanisms to all of our Aspire.Hosting.* packages which is a big step up in the dependency graph for hosting packages. Its probably not something we would want to rush into an 8.x release or even backport given the some of the churn that would involve.

@davidfowl
Copy link
Member

Aspire 9.x is going to be compatible with .NET 8.

@mitchdenny
Copy link
Member Author

Principal feature work for this is now in. We have a few trailing issues:

#5469
#5557
#5558
#5569

@davidfowl
Copy link
Member

This is done

@JeroMiya
Copy link

Big "Thank you!" to everyone involved in getting this through!

@plppp2001
Copy link

The .WaitFor(...) dependicies will be available in Aspire .net 9 release?

thanks

@davidfowl
Copy link
Member

Yes. You can read the 9.0 rc1 docs https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/dotnet-aspire-9-release-candidate-1?tabs=windows&pivots=vscode#waiting-for-dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

No branches or pull requests

5 participants