From 41c1ed77964f16744d9f27fd9e252760fdea9b4b Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Fri, 11 Sep 2026 16:50:52 +0100 Subject: [PATCH] Configure Uptime Kuma monitoring and update dependencies --- Directory.Packages.props | 56 +++++++++---------- .../Bootstrapper/MiddlewareRegistry.cs | 3 + FileProcessor/Startup.cs | 21 +++++-- FileProcessor/appsettings.json | 7 +++ 4 files changed, 53 insertions(+), 34 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 4ce9554..ff462c7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,28 +4,28 @@ - - - + + + - + - - - - - - - - - - - + + + + + + + + + + + @@ -35,17 +35,17 @@ - + - - - - - - - - + + + + + + + + @@ -54,10 +54,10 @@ - - - + + + - + \ No newline at end of file diff --git a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs index 39a43b6..f987e35 100644 --- a/FileProcessor/Bootstrapper/MiddlewareRegistry.cs +++ b/FileProcessor/Bootstrapper/MiddlewareRegistry.cs @@ -1,5 +1,6 @@ using KurrentDB.Client; using Microsoft.OpenApi; +using Shared.Monitoring; namespace FileProcessor.Bootstrapper { @@ -118,6 +119,8 @@ public MiddlewareRegistry() options.MultipartBodyLengthLimit = long.MaxValue; // multipart body length options.MemoryBufferThreshold = int.MaxValue; // buffer threshold }); + + this.AddUptimeKuma(); } #endregion diff --git a/FileProcessor/Startup.cs b/FileProcessor/Startup.cs index 7acce98..8ebab2e 100644 --- a/FileProcessor/Startup.cs +++ b/FileProcessor/Startup.cs @@ -1,18 +1,16 @@ +using FileProcessor.Endpoints; +using ImTools; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Shared.Serialisation; using System; using System.Collections.Generic; using System.Linq; -using FileProcessor.Endpoints; -using ImTools; -using Shared.Serialisation; namespace FileProcessor { - using System.Diagnostics.CodeAnalysis; - using System.Reflection; using Bootstrapper; using Common; using HealthChecks.UI.Client; @@ -26,6 +24,9 @@ namespace FileProcessor using Shared.General; using Shared.Logger; using Shared.Middleware; + using Shared.Monitoring; + using System.Diagnostics.CodeAnalysis; + using System.Reflection; using ILogger = Microsoft.Extensions.Logging.ILogger; [ExcludeFromCodeCoverage] @@ -100,7 +101,8 @@ public static void LoadDomainEventsTypeDynamically(List assemblyFilters } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory, + IHostApplicationLifetime lifetime, IHost host) { if (env.IsDevelopment()) { @@ -145,6 +147,13 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF app.UseSwaggerUI(); + lifetime.ApplicationStarted.Register(() => + { + host.RegisterWithUptimeKumaAsync() + .GetAwaiter() + .GetResult(); + }); + app.PreWarm(); } } diff --git a/FileProcessor/appsettings.json b/FileProcessor/appsettings.json index 7f65888..59b6773 100644 --- a/FileProcessor/appsettings.json +++ b/FileProcessor/appsettings.json @@ -29,5 +29,12 @@ ] }, "TemporaryFileLocation": "/home/txnproc/bulkfiles/temporary" + }, + "UptimeKuma": { + "Monitor": { + "Name": "File Processor", + "Url": "http://localhost:5009/health", + "IntervalInSeconds": 60 + } } }