diff --git a/Directory.Packages.props b/Directory.Packages.props index e36daf7..9050cb1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,53 +3,53 @@ true - - - - - - - - + + + + + + + + - + - - - + + + - + - - - + + + - + - + - - - - - - + + + + + + - + - + - + \ No newline at end of file diff --git a/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs b/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs index 0223c3d..1e9ec30 100644 --- a/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs +++ b/EstateReportingAPI/Bootstrapper/MiddlewareRegistry.cs @@ -1,5 +1,6 @@ using Microsoft.OpenApi; using Shared.Middleware; +using Shared.Monitoring; namespace EstateReportingAPI.Bootstrapper{ using Lamar; @@ -24,6 +25,7 @@ public MiddlewareRegistry() this.ConfigureControllers(); this.ConfigureMiddlewareLogging(); this.ConfigureJsonOptions(); + this.AddUptimeKuma(); } private void ConfigureJsonOptions() diff --git a/EstateReportingAPI/Startup.cs b/EstateReportingAPI/Startup.cs index d41e4fe..7ca14e3 100644 --- a/EstateReportingAPI/Startup.cs +++ b/EstateReportingAPI/Startup.cs @@ -11,6 +11,7 @@ namespace EstateReportingAPI { using Shared.Middleware; + using Shared.Monitoring; using Shared.Serialisation; [ExcludeFromCodeCoverage] @@ -41,7 +42,8 @@ public void ConfigureContainer(ServiceRegistry services) StringSerialiser.Initialise(serialiser); } - 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()) { app.UseDeveloperExceptionPage(); @@ -85,6 +87,13 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse }); }); + + lifetime.ApplicationStarted.Register(() => + { + host.RegisterWithUptimeKumaAsync() + .GetAwaiter() + .GetResult(); + }); } } } \ No newline at end of file diff --git a/EstateReportingAPI/appsettings.json b/EstateReportingAPI/appsettings.json index 54d2c2d..cb3ccb4 100644 --- a/EstateReportingAPI/appsettings.json +++ b/EstateReportingAPI/appsettings.json @@ -7,6 +7,13 @@ }, "SecurityConfiguration": { "ApiName": "estateReporting" + }, + "UptimeKuma": { + "Monitor": { + "Name": "Estate Reporting", + "Url": "http://localhost:5011/health", + "IntervalInSeconds": 60 + } } }