dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.37k stars 348 forks source link

Support for `container app job` on deployment #4366

Open uabarahona opened 1 month ago

uabarahona commented 1 month ago

I been following different tutorials from the docs and one I did is aspire with ef core migrations, I really liked the solution proposed but I believe in order for this example to be fully functional on azure deployment container app job should be supported.

Right now, after deploying an application similar to the example in the docs, I get an app container that runs several times (fixable but not ideal), although migrations is likely not the best example as it should probably not be run as a worker on production environments, this enhancement will still be valid for any other background job.

mitchdenny commented 4 weeks ago

We would like to do this. We are doing some work around being able to customize the shape of the container app that is deployed for a particular project. This is probably something that we would pick up after we get that working.

Scott-MRI commented 1 week ago

To piggyback on this, I was looking to add a Container App Job under .NET Aspire. I started exploring this as I'm working on a solution that is currently using App Jobs, but I was getting a bit frustrated with the logging and integration with Log Analytics and Application Insights, and .NET Aspire packaged everything up in a nice bundle with a great dashboard for monitoring/troubleshooting which is a definite need.

Anyhow, I thought I could get away with a custom scale rule just deploying as a Container App and having it run, do it's work and then shut down. A couple of problems with that, I didn't see a way to define the polling interval on the custom event type (looking a service bus queues) and after that, each time I deployed, the scale rule would be gone. I'm just getting started in Azure, so maybe there is a way to customize the deploy scripts to configure this each time.

Would all of this be included in customizing the shape of the container app?

mitchdenny commented 1 week ago

The way we are currently looking at it is that customization will come in the form of another resource that references the project, the new resource would just be a Bicep resource and we would allow of virtually complete customization. Container job support is right up there.