diff --git a/.github/workflows/.net-build-modularmonolith.yml b/.github/workflows/.net-build-modularmonolith.yml
index e5d8b6ac2..ee41de2d1 100644
--- a/.github/workflows/.net-build-modularmonolith.yml
+++ b/.github/workflows/.net-build-modularmonolith.yml
@@ -23,7 +23,10 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.100
-
+
+ - name: Install Aspire
+ run: dotnet workload install aspire
+
- name: Build
run: dotnet build --configuration Release
diff --git a/src/ModularMonolith/ClassifiedAds.AspireAppHost/ClassifiedAds.AspireAppHost.csproj b/src/ModularMonolith/ClassifiedAds.AspireAppHost/ClassifiedAds.AspireAppHost.csproj
new file mode 100644
index 000000000..f47a3e2d0
--- /dev/null
+++ b/src/ModularMonolith/ClassifiedAds.AspireAppHost/ClassifiedAds.AspireAppHost.csproj
@@ -0,0 +1,21 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/ModularMonolith/ClassifiedAds.AspireAppHost/Program.cs b/src/ModularMonolith/ClassifiedAds.AspireAppHost/Program.cs
new file mode 100644
index 000000000..4c4602226
--- /dev/null
+++ b/src/ModularMonolith/ClassifiedAds.AspireAppHost/Program.cs
@@ -0,0 +1,10 @@
+var builder = DistributedApplication.CreateBuilder(args);
+
+var migrator = builder.AddProject("ClassifiedAds-Migrator");
+var background = builder.AddProject("ClassifiedAds-BackgroundServer");
+var webApi = builder.AddProject("ClassifiedAds-WebAPI");
+
+var identityServer = builder
+ .AddExecutable("ClassifiedAds-IdentityServer", "dotnet", "../../IdentityServer/IdentityServer4/ClassifiedAds.IdentityServer", "run", $"--urls=https://localhost:44367");
+
+builder.Build().Run();
\ No newline at end of file
diff --git a/src/ModularMonolith/ClassifiedAds.AspireAppHost/Properties/launchSettings.json b/src/ModularMonolith/ClassifiedAds.AspireAppHost/Properties/launchSettings.json
new file mode 100644
index 000000000..a87ca2849
--- /dev/null
+++ b/src/ModularMonolith/ClassifiedAds.AspireAppHost/Properties/launchSettings.json
@@ -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"
+ }
+ }
+ }
+}
diff --git a/src/ModularMonolith/ClassifiedAds.AspireAppHost/appsettings.Development.json b/src/ModularMonolith/ClassifiedAds.AspireAppHost/appsettings.Development.json
new file mode 100644
index 000000000..0c208ae91
--- /dev/null
+++ b/src/ModularMonolith/ClassifiedAds.AspireAppHost/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/src/ModularMonolith/ClassifiedAds.AspireAppHost/appsettings.json b/src/ModularMonolith/ClassifiedAds.AspireAppHost/appsettings.json
new file mode 100644
index 000000000..10f68b8c8
--- /dev/null
+++ b/src/ModularMonolith/ClassifiedAds.AspireAppHost/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/src/ModularMonolith/ClassifiedAds.BackgroundServer/Dockerfile b/src/ModularMonolith/ClassifiedAds.BackgroundServer/Dockerfile
index 75de729e3..dfcc52f3b 100644
--- a/src/ModularMonolith/ClassifiedAds.BackgroundServer/Dockerfile
+++ b/src/ModularMonolith/ClassifiedAds.BackgroundServer/Dockerfile
@@ -7,23 +7,20 @@ COPY ./ClassifiedAds.CrossCuttingConcerns/*.csproj ./ClassifiedAds.CrossCuttingC
COPY ./ClassifiedAds.Domain/*.csproj ./ClassifiedAds.Domain/
COPY ./ClassifiedAds.Infrastructure/*.csproj ./ClassifiedAds.Infrastructure/
+RUN dotnet restore ./ClassifiedAds.Application/ClassifiedAds.Application.csproj
+RUN dotnet restore ./ClassifiedAds.Infrastructure/ClassifiedAds.Infrastructure.csproj
+
COPY ./ClassifiedAds.Contracts/*.csproj ./ClassifiedAds.Contracts/
COPY ./ClassifiedAds.Modules.AuditLog/*.csproj ./ClassifiedAds.Modules.AuditLog/
COPY ./ClassifiedAds.Modules.Configuration/*.csproj ./ClassifiedAds.Modules.Configuration/
COPY ./ClassifiedAds.Modules.Identity/*.csproj ./ClassifiedAds.Modules.Identity/
COPY ./ClassifiedAds.Modules.Notification/*.csproj ./ClassifiedAds.Modules.Notification/
COPY ./ClassifiedAds.Modules.Product/*.csproj ./ClassifiedAds.Modules.Product/
-COPY ./ClassifiedAds.Modules.Product.EndToEndTests/*.csproj ./ClassifiedAds.Modules.Product.EndToEndTests/
-COPY ./ClassifiedAds.Modules.Product.IntegrationTests/*.csproj ./ClassifiedAds.Modules.Product.IntegrationTests/
-COPY ./ClassifiedAds.Modules.Product.UnitTests/*.csproj ./ClassifiedAds.Modules.Product.UnitTests/
COPY ./ClassifiedAds.Modules.Storage/*.csproj ./ClassifiedAds.Modules.Storage/
COPY ./ClassifiedAds.BackgroundServer/*.csproj ./ClassifiedAds.BackgroundServer/
-COPY ./ClassifiedAds.Migrator/*.csproj ./ClassifiedAds.Migrator/
-COPY ./ClassifiedAds.WebAPI/*.csproj ./ClassifiedAds.WebAPI/
-COPY ./ClassifiedAds.ModularMonolith.sln .
-RUN dotnet restore
+RUN dotnet restore ./ClassifiedAds.BackgroundServer/ClassifiedAds.BackgroundServer.csproj
# Copy everything else and build
COPY . ./
diff --git a/src/ModularMonolith/ClassifiedAds.BackgroundServer/Properties/launchSettings.json b/src/ModularMonolith/ClassifiedAds.BackgroundServer/Properties/launchSettings.json
index 25863dcfb..929d5eba1 100644
--- a/src/ModularMonolith/ClassifiedAds.BackgroundServer/Properties/launchSettings.json
+++ b/src/ModularMonolith/ClassifiedAds.BackgroundServer/Properties/launchSettings.json
@@ -2,7 +2,7 @@
"profiles": {
"ClassifiedAds.BackgroundServer": {
"commandName": "Project",
- "dotnetRunMessages": "true",
+ "dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
diff --git a/src/ModularMonolith/ClassifiedAds.Infrastructure/Monitoring/OpenTelemetry/OpenTelemetryExtensions.cs b/src/ModularMonolith/ClassifiedAds.Infrastructure/Monitoring/OpenTelemetry/OpenTelemetryExtensions.cs
index 6fd2960e0..9a7ed8dea 100644
--- a/src/ModularMonolith/ClassifiedAds.Infrastructure/Monitoring/OpenTelemetry/OpenTelemetryExtensions.cs
+++ b/src/ModularMonolith/ClassifiedAds.Infrastructure/Monitoring/OpenTelemetry/OpenTelemetryExtensions.cs
@@ -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 =>
{
diff --git a/src/ModularMonolith/ClassifiedAds.Migrator/Dockerfile b/src/ModularMonolith/ClassifiedAds.Migrator/Dockerfile
index 6a7549ccf..e6ed66e34 100644
--- a/src/ModularMonolith/ClassifiedAds.Migrator/Dockerfile
+++ b/src/ModularMonolith/ClassifiedAds.Migrator/Dockerfile
@@ -7,23 +7,20 @@ COPY ./ClassifiedAds.CrossCuttingConcerns/*.csproj ./ClassifiedAds.CrossCuttingC
COPY ./ClassifiedAds.Domain/*.csproj ./ClassifiedAds.Domain/
COPY ./ClassifiedAds.Infrastructure/*.csproj ./ClassifiedAds.Infrastructure/
+RUN dotnet restore ./ClassifiedAds.Application/ClassifiedAds.Application.csproj
+RUN dotnet restore ./ClassifiedAds.Infrastructure/ClassifiedAds.Infrastructure.csproj
+
COPY ./ClassifiedAds.Contracts/*.csproj ./ClassifiedAds.Contracts/
COPY ./ClassifiedAds.Modules.AuditLog/*.csproj ./ClassifiedAds.Modules.AuditLog/
COPY ./ClassifiedAds.Modules.Configuration/*.csproj ./ClassifiedAds.Modules.Configuration/
COPY ./ClassifiedAds.Modules.Identity/*.csproj ./ClassifiedAds.Modules.Identity/
COPY ./ClassifiedAds.Modules.Notification/*.csproj ./ClassifiedAds.Modules.Notification/
COPY ./ClassifiedAds.Modules.Product/*.csproj ./ClassifiedAds.Modules.Product/
-COPY ./ClassifiedAds.Modules.Product.EndToEndTests/*.csproj ./ClassifiedAds.Modules.Product.EndToEndTests/
-COPY ./ClassifiedAds.Modules.Product.IntegrationTests/*.csproj ./ClassifiedAds.Modules.Product.IntegrationTests/
-COPY ./ClassifiedAds.Modules.Product.UnitTests/*.csproj ./ClassifiedAds.Modules.Product.UnitTests/
COPY ./ClassifiedAds.Modules.Storage/*.csproj ./ClassifiedAds.Modules.Storage/
-COPY ./ClassifiedAds.BackgroundServer/*.csproj ./ClassifiedAds.BackgroundServer/
COPY ./ClassifiedAds.Migrator/*.csproj ./ClassifiedAds.Migrator/
-COPY ./ClassifiedAds.WebAPI/*.csproj ./ClassifiedAds.WebAPI/
-COPY ./ClassifiedAds.ModularMonolith.sln .
-RUN dotnet restore
+RUN dotnet restore ./ClassifiedAds.Migrator/ClassifiedAds.Migrator.csproj
# Copy everything else and build
COPY . ./
diff --git a/src/ModularMonolith/ClassifiedAds.Migrator/Properties/launchSettings.json b/src/ModularMonolith/ClassifiedAds.Migrator/Properties/launchSettings.json
index c848ddb42..3836554e7 100644
--- a/src/ModularMonolith/ClassifiedAds.Migrator/Properties/launchSettings.json
+++ b/src/ModularMonolith/ClassifiedAds.Migrator/Properties/launchSettings.json
@@ -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"
}
}
}
\ No newline at end of file
diff --git a/src/ModularMonolith/ClassifiedAds.ModularMonolith.sln b/src/ModularMonolith/ClassifiedAds.ModularMonolith.sln
index db09463c1..76f2f4292 100644
--- a/src/ModularMonolith/ClassifiedAds.ModularMonolith.sln
+++ b/src/ModularMonolith/ClassifiedAds.ModularMonolith.sln
@@ -57,6 +57,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassifiedAds.Contracts", "
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Contracts", "Contracts", "{F7978955-2598-49D1-BB01-293F061004F1}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassifiedAds.AspireAppHost", "ClassifiedAds.AspireAppHost\ClassifiedAds.AspireAppHost.csproj", "{F836AAB2-BB6D-4725-BD4D-36E425BA7AB7}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -131,6 +133,10 @@ Global
{00E6AFF5-98AA-4302-A33D-E3E4B9D15504}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00E6AFF5-98AA-4302-A33D-E3E4B9D15504}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00E6AFF5-98AA-4302-A33D-E3E4B9D15504}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F836AAB2-BB6D-4725-BD4D-36E425BA7AB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F836AAB2-BB6D-4725-BD4D-36E425BA7AB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F836AAB2-BB6D-4725-BD4D-36E425BA7AB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F836AAB2-BB6D-4725-BD4D-36E425BA7AB7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -159,6 +165,7 @@ Global
{B556F32D-D996-4296-9075-E7E2E2F4B8C3} = {ECEF010F-6A7B-4418-83FF-1BEBA02A7F96}
{ECEF010F-6A7B-4418-83FF-1BEBA02A7F96} = {38967FEA-2C16-4297-8028-1B83DC14AC3F}
{00E6AFF5-98AA-4302-A33D-E3E4B9D15504} = {F7978955-2598-49D1-BB01-293F061004F1}
+ {F836AAB2-BB6D-4725-BD4D-36E425BA7AB7} = {62A1AB08-A2DB-404F-B073-0F89CA780F45}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2C23354-4AAD-41AC-9E06-0A6F210ACEEF}
diff --git a/src/ModularMonolith/ClassifiedAds.WebAPI/Dockerfile b/src/ModularMonolith/ClassifiedAds.WebAPI/Dockerfile
index ca52e452b..a20b8ea72 100644
--- a/src/ModularMonolith/ClassifiedAds.WebAPI/Dockerfile
+++ b/src/ModularMonolith/ClassifiedAds.WebAPI/Dockerfile
@@ -7,23 +7,20 @@ COPY ./ClassifiedAds.CrossCuttingConcerns/*.csproj ./ClassifiedAds.CrossCuttingC
COPY ./ClassifiedAds.Domain/*.csproj ./ClassifiedAds.Domain/
COPY ./ClassifiedAds.Infrastructure/*.csproj ./ClassifiedAds.Infrastructure/
+RUN dotnet restore ./ClassifiedAds.Application/ClassifiedAds.Application.csproj
+RUN dotnet restore ./ClassifiedAds.Infrastructure/ClassifiedAds.Infrastructure.csproj
+
COPY ./ClassifiedAds.Contracts/*.csproj ./ClassifiedAds.Contracts/
COPY ./ClassifiedAds.Modules.AuditLog/*.csproj ./ClassifiedAds.Modules.AuditLog/
COPY ./ClassifiedAds.Modules.Configuration/*.csproj ./ClassifiedAds.Modules.Configuration/
COPY ./ClassifiedAds.Modules.Identity/*.csproj ./ClassifiedAds.Modules.Identity/
COPY ./ClassifiedAds.Modules.Notification/*.csproj ./ClassifiedAds.Modules.Notification/
COPY ./ClassifiedAds.Modules.Product/*.csproj ./ClassifiedAds.Modules.Product/
-COPY ./ClassifiedAds.Modules.Product.EndToEndTests/*.csproj ./ClassifiedAds.Modules.Product.EndToEndTests/
-COPY ./ClassifiedAds.Modules.Product.IntegrationTests/*.csproj ./ClassifiedAds.Modules.Product.IntegrationTests/
-COPY ./ClassifiedAds.Modules.Product.UnitTests/*.csproj ./ClassifiedAds.Modules.Product.UnitTests/
COPY ./ClassifiedAds.Modules.Storage/*.csproj ./ClassifiedAds.Modules.Storage/
-COPY ./ClassifiedAds.BackgroundServer/*.csproj ./ClassifiedAds.BackgroundServer/
-COPY ./ClassifiedAds.Migrator/*.csproj ./ClassifiedAds.Migrator/
COPY ./ClassifiedAds.WebAPI/*.csproj ./ClassifiedAds.WebAPI/
-COPY ./ClassifiedAds.ModularMonolith.sln .
-RUN dotnet restore
+RUN dotnet restore ./ClassifiedAds.WebAPI/ClassifiedAds.WebAPI.csproj
# Copy everything else and build
COPY . ./
diff --git a/src/ModularMonolith/ClassifiedAds.WebAPI/Properties/launchSettings.json b/src/ModularMonolith/ClassifiedAds.WebAPI/Properties/launchSettings.json
index 4c1281c8e..652a52e71 100644
--- a/src/ModularMonolith/ClassifiedAds.WebAPI/Properties/launchSettings.json
+++ b/src/ModularMonolith/ClassifiedAds.WebAPI/Properties/launchSettings.json
@@ -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"
}
}
}
\ No newline at end of file
diff --git a/src/ModularMonolith/ClassifiedAds.WebAPI/appsettings.Development.json b/src/ModularMonolith/ClassifiedAds.WebAPI/appsettings.Development.json
index e203e9407..70869dd6b 100644
--- a/src/ModularMonolith/ClassifiedAds.WebAPI/appsettings.Development.json
+++ b/src/ModularMonolith/ClassifiedAds.WebAPI/appsettings.Development.json
@@ -1,9 +1,26 @@
{
"Logging": {
"LogLevel": {
- "Default": "Debug",
- "System": "Information",
- "Microsoft": "Information"
+ "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"
+ }
}
}
}