Skip to content

Commit

Permalink
Added Aspire configuration (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
csharpfritz authored Jun 20, 2024
1 parent be68e89 commit 94b00df
Show file tree
Hide file tree
Showing 44 changed files with 804 additions and 374 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ jobs:

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4


- name: Workload install
run: dotnet workload restore

- name: Version stamping
id: nbgv_version
uses: dotnet/nbgv@v0.4
Expand Down
33 changes: 33 additions & 0 deletions src/TagzApp.AppHost/DatabaseService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TagzApp.AppHost;
public static class DatabaseConfig
{


public static IDistributedApplicationBuilder AddDatabase(
this IDistributedApplicationBuilder builder
, out IResourceBuilder<PostgresDatabaseResource> db
, out IResourceBuilder<PostgresDatabaseResource> securityDb)
{

var dbPassword = builder.AddParameter("dbPassword", false);

var dbServer = builder.AddPostgres("dbServer", password: dbPassword)
.WithPgAdmin()
.WithDataVolume("tagzapp-dev");

db = dbServer.AddDatabase("tagzappdb");

securityDb = dbServer.AddDatabase("securitydb");

return builder;

}


}
26 changes: 26 additions & 0 deletions src/TagzApp.AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Aspire.Hosting;
using TagzApp.AppHost;

var builder = DistributedApplication.CreateBuilder(args);

builder.AddDatabase(out var db, out var securityDb);

var twitchCache = builder.AddRedis("twitchCache");
var twitchRelay = builder.AddExecutable("twitchrelay",
"func", @"..\TagzApp.TwitchRelay", "start", "--verbose", "--port", "7082")
.WithHttpEndpoint(7082, 7082,"http", "foo", false)
.WithEnvironment("cache", twitchCache.Resource.ConnectionStringExpression)
.WithEnvironment("TwitchRedirectUri", "http://localhost:7082/api/twitchcallback");

#region Website

var tagzAppWeb = builder.AddProject<Projects.TagzApp_Blazor>("web", "https")
.WithReference(db)
.WithReference(securityDb)
.WithEnvironment("TwitchRelayUri", "http://localhost:7082");

#endregion

builder.Build().Run();


29 changes: 29 additions & 0 deletions src/TagzApp.AppHost/Properties/launchSettings.json
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:17060;http://localhost:15088",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21115",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22194"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15088",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19176",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20031"
}
}
}
}
24 changes: 24 additions & 0 deletions src/TagzApp.AppHost/TagzApp.AppHost.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
<UserSecretsId>9620e5ce-6c82-4271-9ba8-e10189d974b1</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.0.1" />
<PackageReference Include="Aspire.Hosting.Azure.PostgreSQL" Version="8.0.1" />
<PackageReference Include="Aspire.Hosting.NodeJs" Version="8.0.1" />
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="8.0.1" />
<PackageReference Include="Aspire.Hosting.Redis" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TagzApp.Blazor\TagzApp.Blazor.csproj" />
</ItemGroup>

</Project>
8 changes: 8 additions & 0 deletions src/TagzApp.AppHost/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
12 changes: 12 additions & 0 deletions src/TagzApp.AppHost/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
},
"Parameters": {
"dbPassword": "MyPassw0rd!"
}
}
6 changes: 3 additions & 3 deletions src/TagzApp.Blazor.Client/TagzApp.Blazor.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 94b00df

Please sign in to comment.