Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
Hosting.GoFeatureFlag.Tests,
Hosting.Golang.Tests,
Hosting.Java.Tests,
Hosting.k6.Tests,
Hosting.LavinMQ.Tests,
Hosting.MailPit.Tests,
Hosting.Meilisearch.Tests,
Expand Down
38 changes: 38 additions & 0 deletions CommunityToolkit.Aspire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hos
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.Azure.Dapr.AppHost", "examples\dapr\CommunityToolkit.Aspire.Hosting.Azure.Dapr.AppHost\CommunityToolkit.Aspire.Hosting.Azure.Dapr.AppHost.csproj", "{39A6C03B-52AB-45F4-8D01-C3A1E5095765}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.k6", "src\CommunityToolkit.Aspire.Hosting.k6\CommunityToolkit.Aspire.Hosting.k6.csproj", "{C72E4CF1-EDEF-4AA8-A116-DAD99A86B531}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k6", "k6", "{612ECA40-80B7-4365-9A6A-C35A6BE30FED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.k6.AppHost", "examples\k6\CommunityToolkit.Aspire.Hosting.k6.AppHost\CommunityToolkit.Aspire.Hosting.k6.AppHost.csproj", "{744F01AD-B28E-4B25-B6BA-42821157CA72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults", "examples\k6\CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults\CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults.csproj", "{15BBCE34-82A2-489C-A65B-5BAEA299F07E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.k6.ApiService", "examples\k6\CommunityToolkit.Aspire.Hosting.k6.ApiService\CommunityToolkit.Aspire.Hosting.k6.ApiService.csproj", "{9DB0C7B2-31D3-481C-9C0C-EEAEC9B2AA6A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityToolkit.Aspire.Hosting.k6.Tests", "tests\CommunityToolkit.Aspire.Hosting.k6.Tests\CommunityToolkit.Aspire.Hosting.k6.Tests.csproj", "{CCFE3593-49A7-4F03-A329-687490CD0143}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -947,6 +959,26 @@ Global
{39A6C03B-52AB-45F4-8D01-C3A1E5095765}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39A6C03B-52AB-45F4-8D01-C3A1E5095765}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39A6C03B-52AB-45F4-8D01-C3A1E5095765}.Release|Any CPU.Build.0 = Release|Any CPU
{C72E4CF1-EDEF-4AA8-A116-DAD99A86B531}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C72E4CF1-EDEF-4AA8-A116-DAD99A86B531}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C72E4CF1-EDEF-4AA8-A116-DAD99A86B531}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C72E4CF1-EDEF-4AA8-A116-DAD99A86B531}.Release|Any CPU.Build.0 = Release|Any CPU
{744F01AD-B28E-4B25-B6BA-42821157CA72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{744F01AD-B28E-4B25-B6BA-42821157CA72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{744F01AD-B28E-4B25-B6BA-42821157CA72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{744F01AD-B28E-4B25-B6BA-42821157CA72}.Release|Any CPU.Build.0 = Release|Any CPU
{15BBCE34-82A2-489C-A65B-5BAEA299F07E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15BBCE34-82A2-489C-A65B-5BAEA299F07E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15BBCE34-82A2-489C-A65B-5BAEA299F07E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15BBCE34-82A2-489C-A65B-5BAEA299F07E}.Release|Any CPU.Build.0 = Release|Any CPU
{9DB0C7B2-31D3-481C-9C0C-EEAEC9B2AA6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9DB0C7B2-31D3-481C-9C0C-EEAEC9B2AA6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9DB0C7B2-31D3-481C-9C0C-EEAEC9B2AA6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9DB0C7B2-31D3-481C-9C0C-EEAEC9B2AA6A}.Release|Any CPU.Build.0 = Release|Any CPU
{CCFE3593-49A7-4F03-A329-687490CD0143}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCFE3593-49A7-4F03-A329-687490CD0143}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCFE3593-49A7-4F03-A329-687490CD0143}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCFE3593-49A7-4F03-A329-687490CD0143}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1128,6 +1160,12 @@ Global
{92D490BC-B953-45DC-8F9D-A992B2AEF96A} = {41ACF613-EE5A-5900-F4D1-9FB713A32BE8}
{27144ED2-9F74-4A86-AABA-38CD061D8984} = {41ACF613-EE5A-5900-F4D1-9FB713A32BE8}
{39A6C03B-52AB-45F4-8D01-C3A1E5095765} = {E3C2B4B7-B3B0-4E7F-A975-A6C7FD926792}
{C72E4CF1-EDEF-4AA8-A116-DAD99A86B531} = {414151D4-7009-4E78-A5C6-D99EBD1E67D1}
{612ECA40-80B7-4365-9A6A-C35A6BE30FED} = {8519CC01-1370-47C8-AD94-B0F326B1563F}
{744F01AD-B28E-4B25-B6BA-42821157CA72} = {612ECA40-80B7-4365-9A6A-C35A6BE30FED}
{15BBCE34-82A2-489C-A65B-5BAEA299F07E} = {612ECA40-80B7-4365-9A6A-C35A6BE30FED}
{9DB0C7B2-31D3-481C-9C0C-EEAEC9B2AA6A} = {612ECA40-80B7-4365-9A6A-C35A6BE30FED}
{CCFE3593-49A7-4F03-A329-687490CD0143} = {899F0713-7FC6-4750-BAFC-AC650B35B453}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {08B1D4B8-D2C5-4A64-BB8B-E1A2B29525F0}
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This repository contains the source code for the .NET Aspire Community Toolkit,
| - **Learn More**: [`Hosting.Java`][java-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Java][java-shields]][java-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Java][java-shields-preview]][java-nuget-preview] | An integration for running Java code in .NET Aspire either using the local JDK or using a container. |
| - **Learn More**: [`Hosting.NodeJS.Extensions`][nodejs-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.NodeJS.Extensions][nodejs-ext-shields]][nodejs-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.NodeJS.Extensions][nodejs-ext-shields-preview]][nodejs-ext-nuget-preview] | An integration that contains some additional extensions for running Node.js applications |
| - **Learn More**: [`Hosting.Ollama`][ollama-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Ollama][ollama-shields]][ollama-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Ollama][ollama-shields-preview]][ollama-nuget-preview] | An Aspire hosting integration leveraging the [Ollama](https://ollama.com) container with support for downloading a model on startup. |
| - **Learn More**: [`OllamaSharp`][ollama-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.OllamaSharp][ollamasharp-shields]][ollamasharp-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.OllamaSharp][ollamasharp-shields-preview]][ollama-nuget-preview] | An Aspire client integration for the [OllamaSharp](https://github.com/awaescher/OllamaSharp) package. |
| - **Learn More**: [`OllamaSharp`][ollama-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.OllamaSharp][ollamasharp-shields]][ollamasharp-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.OllamaSharp][ollamasharp-shields-preview]][ollamasharp-nuget-preview] | An Aspire client integration for the [OllamaSharp](https://github.com/awaescher/OllamaSharp) package. |
| - **Learn More**: [`Hosting.Meilisearch`][meilisearch-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Meilisearch][meilisearch-shields]][meilisearch-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Meilisearch][meilisearch-shields-preview]][meilisearch-nuget-preview] | An Aspire hosting integration leveraging the [Meilisearch](https://meilisearch.com) container. |
| - **Learn More**: [`Meilisearch`][meilisearch-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Meilisearch][meilisearch-client-shields]][meilisearch-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Meilisearch][meilisearch-client-shields-preview]][meilisearch-client-nuget-preview] | An Aspire client integration for the [Meilisearch](https://github.com/meilisearch/meilisearch-dotnet) package. |
| - **Learn More**: [`Hosting.Azure.DataApiBuilder`][dab-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder][dab-shields]][dab-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder][dab-shields-preview]][dab-nuget-preview] | A hosting integration for the [Azure Data API builder](https://learn.microsoft.com/en-us/azure/data-api-builder/overview). |
Expand All @@ -46,6 +46,7 @@ This repository contains the source code for the .NET Aspire Community Toolkit,
| - **Learn More**: [`Hosting.SqlServer.Extensions`][sqlserver-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.SqlServer.Extensions][sqlserver-ext-shields]][sqlserver-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.SqlServer.Extensions][sqlserver-ext-shields-preview]][sqlserver-ext-nuget-preview] | An integration that contains some additional extensions for hosting SqlServer container. |
| - **Learn More**: [`Hosting.LavinMQ`][lavinmq-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.LavinMQ][lavinmq-shields]][lavinmq-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.LavinMQ][lavinmq-shields-preview]][lavinmq-nuget-preview] | An Aspire hosting integration for [LavinMQ](https://www.lavinmq.com). |
| - **Learn More**: [`Hosting.MailPit`][mailpit-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.MailPit][mailpit-ext-shields]][mailpit-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.MailPit][mailpit-ext-shields-preview]][mailpit-ext-nuget-preview] | An Aspire integration leveraging the [MailPit](https://mailpit.axllent.org/) container. |
| - **Learn More**: [`Hosting.k6`][k6-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.k6][k6-shields]][k6-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.k6][k6-shields-preview]][k6-nuget-preview] | An Aspire integration leveraging the [Grafana k6](https://k6.io/) container. |

## 🙌 Getting Started

Expand Down Expand Up @@ -240,3 +241,8 @@ This project is supported by the [.NET Foundation](https://dotnetfoundation.org)
[mailpit-ext-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.MailPit/
[mailpit-ext-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.MailPit?label=nuget%20(preview)
[mailpit-ext-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.MailPit/absoluteLatest
[k6-integration-docs]: https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-k6
[k6-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Hosting.k6
[k6-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.k6/
[k6-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.k6?label=nuget%20(preview)
[k6-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.k6/absoluteLatest
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults\CommunityToolkit.Aspire.Hosting.k6.ServiceDefaults.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
var builder = WebApplication.CreateBuilder(args);

builder.AddServiceDefaults();

var app = builder.Build();

app.UseOutputCache();

app.MapDefaultEndpoints();

string[] summaries =
[
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
];

var helloWorldFn = static () => "Hello World!";
var weathersFn = () =>
Enumerable.Range(0, 6).Select(index =>
new WeatherForecast(
DateTime.Now.AddDays(index),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
)
);

app.MapGet("/hello", helloWorldFn);
app.MapGet("/api/weather", weathersFn);

var cachedGroup = app
.MapGroup("")
.CacheOutput(o => o.Cache());

cachedGroup.MapGet("/hello/cached", () => helloWorldFn);
cachedGroup.MapGet("/api/weather/cached", weathersFn);

app.Run();

record WeatherForecast(DateTime Date, int TemperatureC, string Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5048",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7213;http://localhost:5048",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Aspire.AppHost.Sdk" Version="$(AspireAppHostSdkVersion)"/>

<PropertyGroup>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>bdd580db-20ba-4a95-95a1-a8b4dbe0521d</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\CommunityToolkit.Aspire.Hosting.k6\CommunityToolkit.Aspire.Hosting.k6.csproj" IsAspireProjectResource="false" />
<ProjectReference Include="..\CommunityToolkit.Aspire.Hosting.k6.ApiService\CommunityToolkit.Aspire.Hosting.k6.ApiService.csproj" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions examples/k6/CommunityToolkit.Aspire.Hosting.k6.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Projects;

var builder = DistributedApplication.CreateBuilder(args);

var apiservice = builder
.AddProject<CommunityToolkit_Aspire_Hosting_k6_ApiService>("apiservice")
.WithHttpHealthCheck("/health");

var k6 = builder.AddK6("k6")
.WithBindMount("scripts", "/scripts", true)
.WithScript("/scripts/main.js")
.WithReference(apiservice)
.WaitFor(apiservice);

builder.Build().Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17137;http://localhost:15219",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21037",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22238"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15219",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19071",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20061"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import http from "k6/http";
import { sleep } from "k6";

export default function () {
http.get(`${__ENV.services__apiservice__http__0}/hello`);

sleep(1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App"/>

<PackageReference Include="Microsoft.Extensions.Http.Resilience" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
</ItemGroup>

</Project>
Loading
Loading