-
Notifications
You must be signed in to change notification settings - Fork 476
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
Add a hosting helper method for adding a persistent volume mount to containers #1132
Comments
Where would the volume mount be rooted? I like the idea generally, just need to figure out a few details. |
When the volume mount is named, you don't specify where it's rooted AFAICT, it just becomes a named volume that's managed by the Docker host. See https://docs.docker.com/storage/volumes/ |
It makes me wonder whether the current shape of |
Similar to #837 (comment) |
I think that there is an argument that volumes should be their own resource. In k8s volumes are a discrete resource often with a specific provider to get away from host specific volume mounts (e.g. ceph). In the cloud (using Azure as an example) you might use Azure Files or Azure Container Storage. |
@mitchdenny as long as it doesn't complicate the really simple scenarios like the one this issue relates to. |
I created a seperate issure for splitting the current WithVolumeMount into two methods (one for bind mounts and one for named volumes): #1437 |
Now that #1437 is complete and we have separate var database = builder.AddSqlServerContainer("sqlserver", "abcdefg123_78")
.WithVolumeMount("data", "/var/opt/mssql")
.AddDatabase("appdb"); The only thing I can think that might be worth adding is that right now it's hard to name the volume based on the application/resource names, but that might be better left to more domain-specific helper methods like #837. Thoughts @davidfowl @JamesNK? |
Agreed, I think we follow the model that @mitchdenny introduced for emulators (UsePersistence()) though maybe we rename it 😄 |
Related #974
As part of putting together the sample in dotnet/aspire-samples#52 it was suggested a new helper method could be added to
Aspire.Hosting
to make this scenario simpler, e.g.:The method
WithPersistentVolume
would be a shortcut toWithVolumeMount(string source, string target, VolumeMountType type, bool isReadOnly)
withsource
being generated from the application name and resource name, e.g.$"{builder.Environment.ApplicationName}.{resourceName}.data"
, andtype
beingVolumeMountType.Named
andisReadOnly
beingfalse
.The text was updated successfully, but these errors were encountered: