From c365af1d422ecc95520ce648c03b1222f1d350c6 Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Tue, 22 Jul 2025 20:19:57 +0200 Subject: [PATCH 1/4] Add Seq support --- .../Common/DependencyInjectionExtensions.cs | 9 +++++++++ src/Vegasco.Server.Api/Vegasco.Server.Api.csproj | 1 + src/Vegasco.Server.AppHost/Program.cs | 10 +++++++++- .../Vegasco.Server.AppHost.csproj | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs b/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs index ccdbd30..5f05e9e 100644 --- a/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs +++ b/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs @@ -18,6 +18,8 @@ public static class DependencyInjectionExtensions /// public static void AddApiServices(this IHostApplicationBuilder builder) { + builder.AddBuilderServices(); + builder.Services .AddMiscellaneousServices() .AddCustomOpenApi() @@ -27,6 +29,13 @@ public static class DependencyInjectionExtensions builder.AddDbContext(); } + private static IHostApplicationBuilder AddBuilderServices(this IHostApplicationBuilder builder) + { + builder.AddSeqEndpoint("seq"); + + return builder; + } + private static IServiceCollection AddMiscellaneousServices(this IServiceCollection services) { services.AddSingleton(() => diff --git a/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj b/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj index 86548ed..461fc82 100644 --- a/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj +++ b/src/Vegasco.Server.Api/Vegasco.Server.Api.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Vegasco.Server.AppHost/Program.cs b/src/Vegasco.Server.AppHost/Program.cs index f3ea64e..81a12e7 100644 --- a/src/Vegasco.Server.AppHost/Program.cs +++ b/src/Vegasco.Server.AppHost/Program.cs @@ -14,13 +14,21 @@ if (builder.Environment.IsDevelopment()) .WithPgAdmin(); } +IResourceBuilder seq = builder.AddSeq("seq") + .WithLifetime(ContainerLifetime.Persistent) + .WithDataVolume() + .WithExternalHttpEndpoints() + .WithImageTag("latest"); + IResourceBuilder postgres = postgresBuilder .AddDatabase(Constants.Database.Name); IResourceBuilder api = builder .AddProject(Constants.Projects.Api) .WithReference(postgres) - .WaitFor(postgres); + .WaitFor(postgres) + .WithReference(seq) + .WaitFor(seq); builder .AddNpmApp("Vegasco-Web", "../Vegasco-Web") diff --git a/src/Vegasco.Server.AppHost/Vegasco.Server.AppHost.csproj b/src/Vegasco.Server.AppHost/Vegasco.Server.AppHost.csproj index 783a0d3..6f4dfb9 100644 --- a/src/Vegasco.Server.AppHost/Vegasco.Server.AppHost.csproj +++ b/src/Vegasco.Server.AppHost/Vegasco.Server.AppHost.csproj @@ -18,6 +18,7 @@ 3.7.115 + -- 2.49.1 From f018e621639b0d5653ab0b329422185f49c31ab5 Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Tue, 22 Jul 2025 21:12:50 +0200 Subject: [PATCH 2/4] Fix Docker build node:lts seems to be bugged, npm binary does not work right --- src/Vegasco-Web/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Vegasco-Web/Dockerfile b/src/Vegasco-Web/Dockerfile index 7a66bc5..5ee1157 100644 --- a/src/Vegasco-Web/Dockerfile +++ b/src/Vegasco-Web/Dockerfile @@ -1,4 +1,4 @@ -FROM node:lts AS build +FROM node:latest AS build RUN npm install -g pnpm ARG CONFIGURATION=development WORKDIR /usr/local/app -- 2.49.1 From 731eab38983356c943d162ac6874e99568000bea Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Tue, 22 Jul 2025 21:13:18 +0200 Subject: [PATCH 3/4] Prevent using seq if no seq host is set --- .../Common/DependencyInjectionExtensions.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs b/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs index 5f05e9e..33acf4f 100644 --- a/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs +++ b/src/Vegasco.Server.Api/Common/DependencyInjectionExtensions.cs @@ -31,7 +31,11 @@ public static class DependencyInjectionExtensions private static IHostApplicationBuilder AddBuilderServices(this IHostApplicationBuilder builder) { - builder.AddSeqEndpoint("seq"); + string? seqHost = builder.Configuration.GetConnectionString("seq"); + if (!string.IsNullOrEmpty(seqHost)) + { + builder.AddSeqEndpoint("seq"); + } return builder; } -- 2.49.1 From 97a275478dd97ab8be42a612f87c4c7ad886935c Mon Sep 17 00:00:00 2001 From: ThompsonNye Date: Tue, 22 Jul 2025 21:13:26 +0200 Subject: [PATCH 4/4] Update configuration documentation in README --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b342469..8f98d6c 100644 --- a/README.md +++ b/README.md @@ -8,12 +8,14 @@ Includes the backend (`src/Vegasco.Server.Api`) and the frontend (`src/Vegasco-W ### Configuration -| Configuration | Description | Default | Required | -|--------------------------|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|----------| -| JWT:MetadataUrl | The oidc meta data url | - | true | -| JWT:ValidAudience | The valid audience of the JWT token. | - | true | -| JWT:NameClaimType | The claim type of the user's name claim. For keycloak, using `preferred_username` is often the better choice. | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | false | -| JWT:AllowHttpMetadataUrl | Whether to allow the meta data url to have http as protocol. Always true when `ASPNETCORE_ENVIRONMENT=true` | false | false | +| Configuration | Description | Default | Required | +|------------------------------------|---------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|----------| +| JWT:MetadataUrl | The oidc meta data url | - | true | +| JWT:ValidAudience | The valid audience of the JWT token. | - | true | +| JWT:NameClaimType | The claim type of the user's name claim. For keycloak, using `preferred_username` is often the better choice. | http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | false | +| JWT:AllowHttpMetadataUrl | Whether to allow the meta data url to have http as protocol. Always true when `ASPNETCORE_ENVIRONMENT=true` | false | false | +| ConnectionStrings:seq | The seq http endpoint to send the logs and traces to. If not set, logs and traces will not be sent to seq. | - | false | +| ConnectionStrings:vegasco-database | The connection string to the postgres database. | - | true | The application uses the prefix `Vegasco_` for environment variable names. The prefix is removed when the application reads the environment variables and duplicate entries are overwritten by the environment variables. -- 2.49.1