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

Adds Milvus to the Aspire hosting/component packages #4179

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

timheuer
Copy link
Member

@timheuer timheuer commented May 15, 2024

Adds the Milvus vector database to Aspire.

  • Hosting component using container standalone
  • Client component using C# Milvus.Client
  • Hosting/Component initial tests
  • Added playground app (use api.http to run the steps) - uses code samples from C# SDK
  • Adds the Attu web admin experience (excluded from publish manifest)

Requires that a parameter exists for the root auth api key
No healthchecks/tracing/metrics available in the C# Milvus.Client

2024-05-14_12-00-12.mp4

/cc @roji @luisquintanilla

Microsoft Reviewers: Open in CodeFlow

EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consumer", "playground\kafka\Consumer\Consumer.csproj", "{7AA4C56C-3BB2-4FF0-BB03-F3F0D6A4FDAB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Consumer", "playground\kafka\Consumer\Consumer.csproj", "{7AA4C56C-3BB2-4FF0-BB03-F3F0D6A4FDAB}"
Copy link
Member

Choose a reason for hiding this comment

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

Any idea why these keep getting updated? Seen it in other PRs too. Result of a merge or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've got a note in to the project team -- I noticed this a while back...I can't explain either :-(

NuGet.config Outdated Show resolved Hide resolved
@mitchdenny
Copy link
Member

This is looking pretty good. Mostly just some minor things and questions. @eerhardt for a once over for the component side of things. I gave it a once over but he is more attuned to that side of things.

@mitchdenny
Copy link
Member

One thing that I'm thinking about is allowing unauthenticated access to Attu?

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Super nice to see this!

@timheuer
Copy link
Member Author

One thing that I'm thinking about is allowing unauthenticated access to Attu?

Attu requires authenticated access to the Milvus instance -- much like things like PgAdmin have a login prompt as well. Is that what you're referring to? Attu starts with a login requirement to an instance of Milvus, it isn't open-ended.

Directory.Packages.props Show resolved Hide resolved
NuGet.config Outdated Show resolved Hide resolved
playground/milvus/MilvusPlayground.ApiService/Program.cs Outdated Show resolved Hide resolved
src/Aspire.Hosting.Milvus/MilvusContainerImageTags.cs Outdated Show resolved Hide resolved
src/Aspire.Hosting.Milvus/MilvusServerResource.cs Outdated Show resolved Hide resolved
src/Components/Aspire.Milvus.Client/README.md Outdated Show resolved Hide resolved
tests/Aspire.Milvus.Client.Tests/AspireMilvusHelpers.cs Outdated Show resolved Hide resolved
tests/Aspire.Milvus.Client.Tests/MilvusContainerFixture.cs Outdated Show resolved Hide resolved
Comment on lines +47 to +50
protected override void TriggerActivity(MilvusClient service)
{
service.GetVersionAsync().Wait();
}
Copy link
Member

Choose a reason for hiding this comment

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

Do we have any tracing with Milvus?

What is the tracing, metrics, and health checks plan for this component?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was planning on logging issues on the component to add some of these. @roji do you know if these may already be in the works?

Copy link
Member Author

Choose a reason for hiding this comment

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

HealthCheck added, tracing/metrics logged at Milvus.Client repo

Copy link
Member

Choose a reason for hiding this comment

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

The tracking issue on the Milvus SDK side is milvus-io/milvus-sdk-csharp#85.

I'm planning on adding tracing support there, but it may take me a bit of time before I get around to it... Re metrics, I think it's more appropriate to get them from Milvus itself (the server), which emits them - see the issue above for some discussion on that. We may want to have a more general discussion on the client vs. server preference for metrics.

- Added health check
- Added example in doc comments
- Modified tests to use testcontainer
- Added WithDataBindMount
@eerhardt
Copy link
Member

Can you also add some end-to-end tests?

[InlineData(TestResourceNames.mongodb)]
[InlineData(TestResourceNames.mysql)]
[InlineData(TestResourceNames.efmysql)]
[InlineData(TestResourceNames.postgres)]
[InlineData(TestResourceNames.efnpgsql)]
[InlineData(TestResourceNames.rabbitmq)]
[InlineData(TestResourceNames.redis)]
[InlineData(TestResourceNames.garnet)]
[InlineData(TestResourceNames.sqlserver)]
public Task VerifyComponentWorks(TestResourceNames resourceName)

See #3839 for an example.

@timheuer timheuer marked this pull request as ready for review May 22, 2024 22:11
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.

Thanks for the contribution!

playground/milvus/MilvusPlayground.ApiService/Program.cs Outdated Show resolved Hide resolved

private static void ConfigureAttuContainer(EnvironmentCallbackContext context, MilvusServerResource resource)
{
context.EnvironmentVariables.Add("MILVUS_URL", $"{resource.PrimaryEndpoint.Scheme}://{resource.PrimaryEndpoint.ContainerHost}:{resource.PrimaryEndpoint.Port}");
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
context.EnvironmentVariables.Add("MILVUS_URL", $"{resource.PrimaryEndpoint.Scheme}://{resource.PrimaryEndpoint.ContainerHost}:{resource.PrimaryEndpoint.Port}");
context.EnvironmentVariables.Add("MILVUS_URL", $"{resource.PrimaryEndpoint.Property(EndpointProperty.Url)}");

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this is a correct edit @eerhardt. See: https://github.com/dotnet/aspire/blob/main/src/Aspire.Hosting.MySql/PhpMyAdminConfigWriterHook.cs#L37 (and Postgres as well) -- for the local dev experience and the admin tools, they are containers needing to access containers. The proxy ports don't help and need the container host network.

Copy link
Member

Choose a reason for hiding this comment

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

@davidfowl @mitchdenny - would it make sense to make a "ContainerHostUrl" property on an Endpoint? That way would could simplify code like this?

Copy link
Member

Choose a reason for hiding this comment

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

I think that we will be able to use the .Url property when this is addressed:

#3735

@timheuer
Copy link
Member Author

timheuer commented Jun 3, 2024

@eerhardt any other feedback to get this over the last mile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants