Skip to content

Conversation

sebastienros
Copy link
Member

@sebastienros sebastienros commented Feb 26, 2025

Description

  • This sets the minimal required file mode for bind mounts, and ensure the tests run with the required file mode for executing non-root containers.
  • This delays the preparation of volume mounts such that these can be added in the AfterEndpointsAllocatedEvent.
  • Update PostgresQL extensions to use the Aspire Store to store configuration.
  • Update MySql extensions to use the Aspire Store to store configuration.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

@@ -1206,6 +1188,8 @@ private async Task CreateContainerAsync(AppResource cr, ILogger resourceLogger,
spec.Ports = BuildContainerPorts(cr);
}

spec.VolumeMounts = BuildBindMounts(modelContainerResource);
Copy link
Member Author

@sebastienros sebastienros Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to be able to add container mount annotations during the AftertEndpointAllocated. The same way endpoints are built in CreateContainerAsync. Otherwise we can't create file mounts with deterministic names based on the file content (for persistent containers).

NB: In the case of MySql/PgSql the target ports are currently used, which are static. Resolution is done thought host name since it's docker to docker communication. This means that at least this part of the configuration in invariant across restarts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write a persistence container test for MySQL and PostgreSQL?

@@ -1206,6 +1188,8 @@ private async Task CreateContainerAsync(AppResource cr, ILogger resourceLogger,
spec.Ports = BuildContainerPorts(cr);
}

spec.VolumeMounts = BuildBindMounts(modelContainerResource);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks really nice. Nice work here! Thanks for the persistence to figure this all out.

@@ -101,25 +101,15 @@ public static IResourceBuilder<SqlServerServerResource> WithDataVolume(this IRes
/// <param name="source">The source directory on the host to mount into the container.</param>
/// <param name="isReadOnly">A flag that indicates if this is a read-only mount.</param>
/// <returns>The <see cref="IResourceBuilder{T}"/>.</returns>
/// <remarks>
/// The container starts up as non-root and the <paramref name="source"/> directory must be readable by the user that the container runs as.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The container starts up as non-root and the <paramref name="source"/> directory must be readable by the user that the container runs as.
/// The container starts up as non-root and the <paramref name="source"/> directory must be readable and writeable by the user that the container runs as.

@sebastienros sebastienros merged commit 7c81ec0 into main Feb 28, 2025
71 checks passed
@sebastienros sebastienros deleted the sebros/unixfilemodes branch February 28, 2025 00:41
danmoseley pushed a commit that referenced this pull request Feb 28, 2025
@github-actions github-actions bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants