Skip to content

Commit

Permalink
(#239) Add Aspire
Browse files Browse the repository at this point in the history
  • Loading branch information
phongnguyend committed Jun 19, 2024
1 parent eab38fb commit 59858c2
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.IdentityServer": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "https://localhost:44367"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"ClassifiedAds.BackgroundServer": {
"commandName": "Project",
"dotnetRunMessages": "true",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.Blazor": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "https://localhost:44331"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.BlazorWebAssembly": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"applicationUrl": "https://localhost:44348",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.GraphQL": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "ui/playground",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "https://localhost:44392"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ public static IServiceCollection AddClassifiedAdsOpenTelemetry(this IServiceColl
return services;
}

var resourceBuilder = ResourceBuilder.CreateDefault().AddService(options.ServiceName);

services.AddOpenTelemetry()
.ConfigureResource(configureResource =>
{
configureResource.AddService(
serviceName: options.ServiceName,
serviceVersion: Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "unknown",
serviceInstanceId: Environment.MachineName);
serviceInstanceId: options.ServiceName + "-" + Environment.MachineName);
})
.WithTracing(builder =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.Migrator": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "https://localhost:44380"
}
}
}
7 changes: 7 additions & 0 deletions src/Monolith/ClassifiedAds.Monolith.sln
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassifiedAds.ContractTests
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassifiedAds.ArchTests", "ClassifiedAds.ArchTests\ClassifiedAds.ArchTests.csproj", "{16D3179E-608B-43A9-8254-B3834E0917FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClasssifiedAds.AspireAppHost", "ClasssifiedAds.AspireAppHost\ClasssifiedAds.AspireAppHost.csproj", "{739FD03C-2211-4867-96B8-95C450E6691F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -131,6 +133,10 @@ Global
{16D3179E-608B-43A9-8254-B3834E0917FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16D3179E-608B-43A9-8254-B3834E0917FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16D3179E-608B-43A9-8254-B3834E0917FC}.Release|Any CPU.Build.0 = Release|Any CPU
{739FD03C-2211-4867-96B8-95C450E6691F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{739FD03C-2211-4867-96B8-95C450E6691F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{739FD03C-2211-4867-96B8-95C450E6691F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{739FD03C-2211-4867-96B8-95C450E6691F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -156,6 +162,7 @@ Global
{C2646CBE-029A-47EA-809E-57C9EE3ABD9B} = {4B31AB94-7016-4C77-951E-84792D6EBEAC}
{65832FF6-24CE-4DAA-BEB6-EBFE76FC46F0} = {60BC7A82-187C-43E2-8C37-DE610700A7FA}
{16D3179E-608B-43A9-8254-B3834E0917FC} = {60BC7A82-187C-43E2-8C37-DE610700A7FA}
{739FD03C-2211-4867-96B8-95C450E6691F} = {C6061573-0203-4860-AD42-4C6C2CF55110}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2C23354-4AAD-41AC-9E06-0A6F210ACEEF}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.WebAPI": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "https://localhost:44312"
}
}
}
17 changes: 17 additions & 0 deletions src/Monolith/ClassifiedAds.WebAPI/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@
"Default": "Information",
"System": "Warning",
"Microsoft": "Warning"
},
"OpenTelemetry": {
"IsEnabled": true,
"ServiceName": "ClassifiedAds.WebAPI",
"Otlp": {
"Endpoint": "https://localhost:21052"
}
}
},
"Monitoring": {
"OpenTelemetry": {
"IsEnabled": true,
"ServiceName": "ClassifiedAds.WebAPI",
"Otlp": {
"IsEnabled": true,
"Endpoint": "https://localhost:21052"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"ClassifiedAds.WebMVC": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
"applicationUrl": "https://localhost:44364"
}
}
}
19 changes: 18 additions & 1 deletion src/Monolith/ClassifiedAds.WebMVC/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"Default": "Information",
"System": "Warning",
"Microsoft": "Warning"
},
"OpenTelemetry": {
"IsEnabled": true,
"ServiceName": "ClassifiedAds.WebMVC",
"Otlp": {
"Endpoint": "https://localhost:21052"
}
}
},
"Monitoring": {
"OpenTelemetry": {
"IsEnabled": true,
"ServiceName": "ClassifiedAds.WebMVC",
"Otlp": {
"IsEnabled": true,
"Endpoint": "https://localhost:21052"
}
}
}
}
12 changes: 0 additions & 12 deletions src/Monolith/ClassifiedAds.WebMVC/appsettings.Production.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
</PropertyGroup>

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

<ItemGroup>
<ProjectReference Include="..\ClassifiedAds.BackgroundServer\ClassifiedAds.BackgroundServer.csproj" />
<ProjectReference Include="..\ClassifiedAds.BlazorServerSide\ClassifiedAds.BlazorServerSide.csproj" />
<ProjectReference Include="..\ClassifiedAds.BlazorWebAssembly\ClassifiedAds.BlazorWebAssembly.csproj" />
<ProjectReference Include="..\ClassifiedAds.GraphQL\ClassifiedAds.GraphQL.csproj" />
<ProjectReference Include="..\ClassifiedAds.Migrator\ClassifiedAds.Migrator.csproj" />
<ProjectReference Include="..\ClassifiedAds.WebAPI\ClassifiedAds.WebAPI.csproj" />
<ProjectReference Include="..\ClassifiedAds.WebMVC\ClassifiedAds.WebMVC.csproj" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions src/Monolith/ClasssifiedAds.AspireAppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var builder = DistributedApplication.CreateBuilder(args);

var migrator = builder.AddProject<Projects.ClassifiedAds_Migrator>("ClassifiedAds-Migrator");
var background = builder.AddProject<Projects.ClassifiedAds_BackgroundServer>("ClassifiedAds-BackgroundServer");
var graphQL = builder.AddProject<Projects.ClassifiedAds_GraphQL>("ClassifiedAds-GraphQL");
var webApi = builder.AddProject<Projects.ClassifiedAds_WebAPI>("ClassifiedAds-WebAPI");
var webMvc = builder.AddProject<Projects.ClassifiedAds_WebMVC>("ClassifiedAds-WebMVC");
var blazorServerSide = builder.AddProject<Projects.ClassifiedAds_BlazorServerSide>("ClassifiedAds-BlazorServerSide");
var blazorWebAssembly = builder.AddProject<Projects.ClassifiedAds_BlazorWebAssembly>("ClassifiedAds-BlazorWebAssembly");

var identityServer = builder
.AddExecutable("ClassifiedAds-IdentityServer", "dotnet", "../../IdentityServer/IdentityServer4/ClassifiedAds.IdentityServer", "run", $"--urls=https://localhost:44367");

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:17063;http://localhost:15113",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21052",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22034"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15113",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19194",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20061"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions src/Monolith/ClasssifiedAds.AspireAppHost/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

0 comments on commit 59858c2

Please sign in to comment.