-
Notifications
You must be signed in to change notification settings - Fork 179
Update to Aspire 9 #43
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
base: main
Are you sure you want to change the base?
Changes from all commits
0167d6f
09cf576
284d5a4
8bd24c4
e1bf350
4b64acf
ed7a0ea
93ef5a2
79e3be1
cb6646d
4ead7ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -396,3 +396,6 @@ FodyWeavers.xsd | |
|
|
||
| # JetBrains Rider | ||
| *.sln.iml | ||
|
|
||
| # Python Virtual Environments | ||
| .venv | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,34 +2,36 @@ | |||||
| <PropertyGroup> | ||||||
| <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> | ||||||
| <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled> | ||||||
| <MicrosoftExtensionsVersion>8.6.0</MicrosoftExtensionsVersion> | ||||||
| <AspireVersion>8.2.0</AspireVersion> | ||||||
| <AspireVersion>9.0.0-rc.1.24509.13</AspireVersion> | ||||||
| <MicrosoftExtensionsAiVersion>9.0.0-preview.9.24507.7</MicrosoftExtensionsAiVersion> | ||||||
| </PropertyGroup> | ||||||
| <ItemGroup> | ||||||
| <!-- Version together with Aspire --> | ||||||
| <PackageVersion Include="Aspire.Azure.Storage.Blobs" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.AppHost" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Azure.Storage" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Qdrant" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Redis" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Testing" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.StackExchange.Redis" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Azure.Storage.Blobs" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.AppHost.SDK" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.AppHost" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Azure.AppContainers" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Azure.Storage" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Python" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Qdrant" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Redis" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Hosting.Testing" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Aspire.StackExchange.Redis" Version="9.0.0-rc.1.24511.1" /> | ||||||
| <PackageVersion Include="Azure.AI.OpenAI" Version="2.1.0-beta.1" /> | ||||||
| <PackageVersion Include="IdentityModel" Version="7.0.0" /> | ||||||
| <PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.7" /> | ||||||
| <PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.7" /> | ||||||
| <PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0-rc.2.24474.3" /> | ||||||
| <PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.0-rc.2.24474.3" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.AI" Version="$(MicrosoftExtensionsAiVersion)" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.AI.Ollama" Version="$(MicrosoftExtensionsAiVersion)" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="$(MicrosoftExtensionsAiVersion)" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(AspireVersion)" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-rc.2.24473.5" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0-rc.1.24511.1" /> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <!-- Version together with ASP.NET --> | ||||||
| <PackageVersion Include="Microsoft.AspNetCore.Components.QuickGrid" Version="8.0.7" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="8.8.0" /> | ||||||
| <PackageVersion Include="Microsoft.AspNetCore.Components.QuickGrid" Version="9.0.0-rc.2.24474.3" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0-rc.2.24473.5" /> | ||||||
| <PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0-preview.9.24511.3" /> | ||||||
| <PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.9.3" /> | ||||||
| <PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter" Version="4.9.3" /> | ||||||
| <PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.9.3" /> | ||||||
|
|
@@ -40,22 +42,23 @@ | |||||
| <PackageVersion Include="Microsoft.SemanticKernel" Version="1.16.0" /> | ||||||
| <!-- Open Telemetry --> | ||||||
| <PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" /> | ||||||
| <PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" /> | ||||||
| <PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0-beta.1" /> | ||||||
| <PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" /> | ||||||
| <PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" /> | ||||||
| <PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" /> | ||||||
| <!----> | ||||||
| <PackageVersion Include="PdfPig" Version="0.1.9-alpha-20240702-65c64" /> | ||||||
| <PackageVersion Include="SmartComponents.AspNetCore" Version="0.1.0-preview10148" /> | ||||||
| <PackageVersion Include="SmartComponents.LocalEmbeddings" Version="0.1.0-preview10148" /> | ||||||
| <PackageVersion Include="SmartComponents.LocalEmbeddings.SemanticKernel" Version="0.1.0-preview10148" /> | ||||||
| <PackageVersion Include="StatefulReconnection" Version="0.1.0" /> | ||||||
| <PackageVersion Include="Markdown2Pdf" Version="2.2.1" /> | ||||||
| <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.0-release-24352-06" /> | ||||||
| <PackageVersion Include="System.Runtime.Caching" Version="9.0.0-rc.2.24473.5" /> | ||||||
| <PackageVersion Include="System.Text.Json" Version="9.0.0-rc.2.24473.5" /> | ||||||
| <PackageVersion Include="xunit" Version="2.9.0" /> | ||||||
| <PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" /> | ||||||
| <PackageVersion Include="Duende.IdentityServer" Version="7.0.6" /> | ||||||
| <PackageVersion Include="Serilog.AspNetCore" Version="8.0.2-dev-00341" /> | ||||||
| <PackageVersion Include="System.Runtime.Caching" Version="8.0.1" /> | ||||||
| </ItemGroup> | ||||||
| </Project> | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <packageSources> | ||
| <!--To inherit the global NuGet package sources remove the <clear/> line below --> | ||
| <clear /> | ||
| <add key="nuget" value="https://api.nuget.org/v3/index.json" /> | ||
| <add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this for the Aspire 9.x prerelease packages?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. These will hit public nuget.org tomorrow. |
||
| </packageSources> | ||
|
|
||
| <packageSourceMapping> | ||
|
|
@@ -12,5 +13,8 @@ | |
| <packageSource key="nuget"> | ||
| <package pattern="*" /> | ||
| </packageSource> | ||
| <packageSource key="dotnet8"> | ||
| <package pattern="*" /> | ||
| </packageSource> | ||
| </packageSourceMapping> | ||
| </configuration> | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,27 +1,25 @@ | ||||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|
|
||||||
| <Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0-rc.1.24511.1" /> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| <PropertyGroup> | ||||||
| <OutputType>Exe</OutputType> | ||||||
| <TargetFramework>net8.0</TargetFramework> | ||||||
| <TargetFramework>net9.0</TargetFramework> | ||||||
| <ImplicitUsings>enable</ImplicitUsings> | ||||||
| <Nullable>enable</Nullable> | ||||||
| <IsAspireHost>true</IsAspireHost> | ||||||
| <UserSecretsId>dbe89ad9-90f1-44de-9646-7e98b2d8c69d</UserSecretsId> | ||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| <PackageReference Include="Aspire.Hosting.AppHost" /> | ||||||
| <PackageReference Include="Aspire.Hosting.Azure.Storage" /> | ||||||
| <PackageReference Include="Aspire.Hosting.PostgreSQL" /> | ||||||
| <PackageReference Include="Aspire.Hosting.Python" /> | ||||||
| <PackageReference Include="Aspire.Hosting.Qdrant" /> | ||||||
| <PackageReference Include="Aspire.Hosting.Redis" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| <ProjectReference Include="..\Backend\Backend.csproj" /> | ||||||
| <ProjectReference Include="..\CustomerWebUI\CustomerWebUI.csproj" /> | ||||||
| <ProjectReference Include="..\IdentityServer\IdentityServer.csproj" /> | ||||||
| <ProjectReference Include="..\StaffWebUI\StaffWebUI.csproj" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| </Project> | ||||||
| </Project> | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,19 @@ | |
|
|
||
| var blobStorage = storage.AddBlobs("eshopsupport-blobs"); | ||
|
|
||
| var pythonInference = builder.AddPythonUvicornApp("python-inference", | ||
| Path.Combine("..", "PythonInference"), port: 62394); | ||
| var stage = builder.ExecutionContext.IsRunMode ? "base" : /* default stage */ null; | ||
| var pythonInference = builder.AddDockerfile("python-inference", "../PythonInference", /* default dockerfile */ null, stage) | ||
| .WithHttpEndpoint(port: 57000, targetPort: 8000) | ||
| .WithContainerRuntimeArgs("--gpus=all") | ||
| .WithLifetime(ContainerLifetime.Persistent); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this definitely work? It does cause the Docker container to keep running even after AppHost is shut down (albeit removing the port mapping, which is a bit inconvenient). But then each time I start the AppHost project using Ctrl+F5, it kills the previous Docker container and starts a new one, which seems to defeat the purpose of the feature.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If you want stable ports inside and outside of Aspire for this resource you can pass the desired port numbers and disable the proxying on the endpoint.
Definitely shouldn't be doing that and I wasn't seeing that locally. It will only do that if it detects changes to the container definition but I'm not sure of the exact variables it includes. @danegsta?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default we consider the container image name (or image sha in the case of building via dockerfile), ports, volume mounts, environment, and the command/arguments used to launch the container. The port mapping shouldn't be lost for a persistent container, but it generally won't show up in the Docker Desktop UI due to a seeming bug in how they report randomly assigned host ports (which we use). You have to inspect the container and look in the networking config section to see the real port, otherwise it just shows up as 0 in the other inspected port data and is missing from the UI. |
||
|
|
||
| if (builder.ExecutionContext.IsRunMode) | ||
| { | ||
| // Mount app files into the container & enable auto-reload when running in development | ||
| pythonInference | ||
| .WithBindMount("../PythonInference", "/app") | ||
| .WithArgs("--reload"); | ||
| } | ||
|
|
||
| var redis = builder.AddRedis("redis"); | ||
|
|
||
|
|
@@ -53,7 +64,7 @@ | |
| .WithReference(chatCompletion) | ||
| .WithReference(blobStorage) | ||
| .WithReference(vectorDb) | ||
| .WithReference(pythonInference) | ||
| .WithReference(pythonInference.GetEndpoint("http")) | ||
| .WithReference(redis) | ||
| .WithEnvironment("IdentityUrl", identityEndpoint) | ||
| .WithEnvironment("ImportInitialDataDir", Path.Combine(builder.AppHostDirectory, "..", "..", "seeddata", isE2ETest ? "test" : "dev")); | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,21 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>net8.0</TargetFramework> | ||
| <TargetFramework>net9.0</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
| <RootNamespace>eShopSupport.DataIngestor</RootNamespace> | ||
| <StartArguments>$(SolutionDir)\seeddata\DataGenerator\output</StartArguments> | ||
| <NoWarn>$(NoWarn);SKEXP0001;SKEXP0020;SKEXP0050</NoWarn> | ||
| <IsAspireHost>true</IsAspireHost> | ||
| <NoWarn>$(NoWarn);SKEXP0001;SKEXP0050</NoWarn> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Backend\Backend.csproj" IsAspireProjectResource="false" /> | ||
| <ProjectReference Include="..\Evaluator\Evaluator.csproj" IsAspireProjectResource="false" /> | ||
| <ProjectReference Include="..\Backend\Backend.csproj" /> | ||
| <ProjectReference Include="..\Evaluator\Evaluator.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Aspire.Hosting.AppHost" /> | ||
| <PackageReference Include="Microsoft.Extensions.Http.Resilience" /> | ||
| <PackageReference Include="Microsoft.SemanticKernel.Core" /> | ||
| <PackageReference Include="PdfPig" /> | ||
| <PackageReference Include="SmartComponents.LocalEmbeddings" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| FROM python:3.12.5-slim AS base | ||
|
|
||
| # Set the working directory, the app files could be bind-mounted here | ||
| WORKDIR /app | ||
|
|
||
| # Copy the requirements file | ||
| COPY requirements.txt . | ||
|
|
||
| # Install dependencies | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| # Ensure the server is accessible from outside the container | ||
| ENV UVICORN_HOST=0.0.0.0 | ||
|
|
||
| # Set the entry point to run the application | ||
| ENTRYPOINT ["python", "-m", "uvicorn", "main:app"] | ||
|
|
||
| CMD [] | ||
|
|
||
| FROM base AS publish | ||
|
|
||
| COPY . . |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using Aspire.Hosting.Testing; | ||
| using Aspire.Hosting; | ||
| using Aspire.Hosting.Testing; | ||
| using eShopSupport.ServiceDefaults.Clients.Backend; | ||
| using IdentityModel.Client; | ||
|
|
||
|
|
@@ -21,7 +22,7 @@ private async Task<DistributedApplication> InitializeAsync() | |
| Environment.CurrentDirectory = Projects.AppHost.ProjectPath; | ||
| Environment.SetEnvironmentVariable("E2E_TEST", "true"); | ||
| Environment.SetEnvironmentVariable("E2E_TEST_CHAT_COMPLETION_CACHE_DIR", | ||
| Path.Combine(Projects.E2ETest.ProjectPath, "ChatCompletionCache")); | ||
| Path.Combine(Projects.AppHost.ProjectPath, "ChatCompletionCache")); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of interest, why change this?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also if you do change this, I think you'd need to regenerate the cache or at least move all its files to the new directory, since they are meant to be stored in source control.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, I think I changed this as a test and forgot to change it back. For a moment at least the E2ETest project no longer showed up as a member of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SteveSandersonMS Actually, I take it back...this still is an issue. E2ETest is no longer in the Projects namespace nor is there any metadata created for it. I'm not sure how this code originally worked, before the update. Is there a better way to get the project path now? |
||
| var builder = await DistributedApplicationTestingBuilder.CreateAsync<Projects.AppHost>(); | ||
| var app = await builder.BuildAsync(); | ||
| await app.StartAsync(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These versions aren't in sync. It would be nice to keep using the common AspireVersion property.