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 350 forks source link

Shared volumes for ProjectResource #4359

Open davidfowl opened 1 month ago

davidfowl commented 1 month ago

Discussed in https://github.com/dotnet/aspire/discussions/4336

Originally posted by **eSPiYa** May 30, 2024 I'm sorry if this was already asked, but I already tried for almost 2 hours to find how to mount a shared volume to my .NET services, preferably a named ones like in Docker(Compose) that can be deleted immediately during development, but I can't find an answer. I just discovered this .NET Aspire last week but tried it just for today. I'm checking out if our application can be converted to Aspire right away. Its main requirement right now is able to write files to a shared volume between instances. Also, how to make sure that this shared volume can be translated to Kubernetes later?
mitchdenny commented 1 month ago

Locally we don't run the .NET project inside a container, so volumes and mounts don't immediately make sense - but it totally makes sense that you might want to do this when you deploy.

We could extend the API surface to allow applying the annotations to the ProjectResource and extend the manifest so we can write these fields. AZD would need to be extended to support it as well.

eSPiYa commented 1 week ago

Locally we don't run the .NET project inside a container

Wait! I thought the .NET projects are running on containers. It got an extension for running with replicas, so I assumed it is containerized.

With the understanding that .NET projects are running on container, I was thinking of making some sort of contribution through an implementation with Docker volumes at first. Then, extend it later for Podman and Kubernetes. But it looks like there are things needed to be done first.

And an extension for this, I think it would be good to have an implementation of mounting volumes from SMB(with authentication) like Azure File Share. Or probably some sort of abstract for PersistentVolume and PersistentVolumeClaims.

davidfowl commented 1 week ago

They run as container when they are deployed, not locally.