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
14 changes: 5 additions & 9 deletions Chapter-1-initial-architecture/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,13 @@ to download it from the official Microsoft website.

=== Run locally

The Fitnet application requires Docker to run properly.
The Fitnet application uses .NET Aspire for local development.

There are only 3 steps you need to start the application:
To run the application locally, follow these steps:

1. Make sure that you are in `/Src` directory.
2. Run `docker-compose build` to build the image of the application.
3. Run `docker-compose up` to start the application. In the meantime it will also start Postgres inside container.

The application runs on port `:8080`. Please navigate to http://localhost:8080 in your browser or http://localhost:8080/swagger/index.html to explore the API.

That's it! You should now be able to run the application using either one of the above. :thumbsup:
1. **Ensure Docker is running** on your machine.
2. **Navigate to the solution root directory** in your terminal.
3. **Run the AppHost project using the following command:**

=== How to run Integration Tests?
To run the integration tests for the project located in the `Fitnet.IntegrationTests` project, you can use either the command:
Expand Down
21 changes: 0 additions & 21 deletions Chapter-1-initial-architecture/Src/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0"/>

<PropertyGroup>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>b4ef32d8-9e82-4dd1-b9a7-bc43e2c564e9</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0"/>
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="9.0.0"/>
Comment thread
kamilbaczek marked this conversation as resolved.
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Fitnet\Fitnet.csproj"/>
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions Chapter-1-initial-architecture/Src/Fitnet.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Projects;

var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres")
.WithImage("postgres", "15.15")
Comment thread
kamilbaczek marked this conversation as resolved.
.WithPgAdmin();

var fitnetDatabase = postgres.AddDatabase("fitnetsdb", "fitnet");
Comment thread
kamilbaczek marked this conversation as resolved.
builder.AddProject<Fitnet>("fitnet")
.WithEnvironment("ASPNETCORE_ENVIRONMENT", "Development")
.WithReference(fitnetDatabase, "Passes")
.WithReference(fitnetDatabase, "Contracts")
.WithReference(fitnetDatabase, "Reports")
.WithReference(fitnetDatabase, "Offers")
.WaitFor(postgres);

await builder.Build().RunAsync();
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17105;http://localhost:15107",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21129",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22189"
}
}
}
}
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
Expand Up @@ -22,7 +22,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.14.0.120626" />
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Update="SonarAnalyzer.CSharp" Version="9.32.0.97167" />
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.14.0.120626" />
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions Chapter-1-initial-architecture/Src/Fitnet.slnx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Solution>
<Project Path="Fitnet.ArchitectureTests\Fitnet.ArchitectureTests.csproj" Type="Classic C#" />
<Project Path="Fitnet.IntegrationTests\Fitnet.IntegrationTests.csproj" Type="Classic C#" />
<Project Path="Fitnet.UnitTests\Fitnet.UnitTests.csproj" Type="Classic C#" />
<Project Path="Fitnet\Fitnet.csproj" Type="Classic C#" />
<Project Path="Fitnet.AppHost/Fitnet.AppHost.csproj" />
<Project Path="Fitnet.ArchitectureTests\Fitnet.ArchitectureTests.csproj" Type="C#" />
<Project Path="Fitnet.IntegrationTests\Fitnet.IntegrationTests.csproj" Type="C#" />
<Project Path="Fitnet.UnitTests\Fitnet.UnitTests.csproj" Type="C#" />
<Project Path="Fitnet\Fitnet.csproj" Type="C#" />
Comment thread
kamilbaczek marked this conversation as resolved.
</Solution>
25 changes: 0 additions & 25 deletions Chapter-1-initial-architecture/Src/Fitnet/.dockerignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable

namespace EvolutionaryArchitecture.Fitnet.Contracts.Data.Database.Migrations;

using System;
using Microsoft.EntityFrameworkCore.Migrations;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable

namespace EvolutionaryArchitecture.Fitnet.Contracts.Data.Database.Migrations;

using System;
using Microsoft.EntityFrameworkCore.Migrations;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable

namespace EvolutionaryArchitecture.Fitnet.Contracts.Data.Database.Migrations;

using System;
using Microsoft.EntityFrameworkCore.Migrations;

Expand Down
8 changes: 1 addition & 7 deletions Chapter-1-initial-architecture/Src/Fitnet/Fitnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
<Content Include="..\..\Docs\Contracts\Api\Contracts.http">
<Link>Contracts.http</Link>
</Content>
<Content Include="..\docker-compose.yml">
<Link>docker-compose.yml</Link>
</Content>
<Content Include="..\Dockerfile">
<Link>Dockerfile</Link>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable

namespace SuperSimpleArchitecture.Fitnet.Migrations.OffersPersistenceMigrations;

using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore.Migrations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable

namespace EvolutionaryArchitecture.Fitnet.Migrations;

using System;
using Microsoft.EntityFrameworkCore.Migrations;

Expand Down
1 change: 0 additions & 1 deletion Chapter-1-initial-architecture/Src/Fitnet/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
builder.Services.AddRequestsValidations();
builder.Services.AddClock();

Comment thread
kamilbaczek marked this conversation as resolved.
// Add modules - each module registers its own options with validation
builder.Services.AddPasses(builder.Configuration);
builder.Services.AddContracts(builder.Configuration);
builder.Services.AddOffers(builder.Configuration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7097;http://localhost:5013",
"applicationUrl": "https://localhost:7098;http://localhost:5014",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
29 changes: 0 additions & 29 deletions Chapter-1-initial-architecture/Src/docker-compose.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ Application:
- https://github.com/dotnet/efcore[Entity Framework]
- https://github.com/npgsql/npgsql[Npgsql]
- https://github.com/SonarSource/sonar-dotnet[SonarAnalyzer]
- https://github.com/dotnet/aspire[.NET Aspire]

Testing:

Expand Down