diff --git a/Directory.Packages.props b/Directory.Packages.props
index f999122..9db7813 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -3,6 +3,7 @@
true
+
@@ -55,4 +56,4 @@
-
+
\ No newline at end of file
diff --git a/SecurityService/Program.cs b/SecurityService/Program.cs
index 2d3f75c..51f2111 100644
--- a/SecurityService/Program.cs
+++ b/SecurityService/Program.cs
@@ -1,10 +1,11 @@
using ClientProxyBase;
using HealthChecks.UI.Client;
+using HealthMonitoring.Client;
using MediatR;
using MessagingService.Client;
using Microsoft.AspNetCore.Authentication;
-using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
+using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Http.Json;
using Microsoft.AspNetCore.HttpLogging;
@@ -31,10 +32,10 @@
using Shared.Logger;
using Shared.Logger.TennantContext;
using Shared.Middleware;
+using Shared.Monitoring;
using Shared.Serialisation;
using System.Reflection;
using System.Security.Cryptography;
-using Shared.Monitoring;
using static OpenIddict.Abstractions.OpenIddictConstants;
using static OpenIddict.Abstractions.OpenIddictConstants.Permissions;
using ILogger = Microsoft.Extensions.Logging.ILogger;
@@ -60,7 +61,11 @@
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
.AddJsonFile($"/home/txnproc/config/appsettings.local.json", optional: true, reloadOnChange: true)
- .AddEnvironmentVariables();
+ .AddEnvironmentVariables()
+ .AddInMemoryCollection(new Dictionary
+ {
+ ["HealthMonitoring:Service:Version"] = Assembly.GetEntryAssembly()?.GetName().Version?.ToString() ?? "0.0.0.0"
+ });
// Build a snapshot of configuration so we can use it immediately (e.g. for Sentry)
var builtConfig = configBuilder.Build();
@@ -235,7 +240,7 @@
else {
builder.Services.AddHealthChecks().AddMessagingService().AddCheck("database").AddCheck("issuer");
}
-builder.Services.AddUptimeKuma();
+builder.Services.AddHealthMonitoringRegistration(builder.Configuration);
builder.Services.AddHttpLogging(loggingOptions =>
{
@@ -352,11 +357,4 @@
app.MapHealthChecks("health", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = Shared.HealthChecks.HealthCheckMiddleware.WriteResponse });
app.MapHealthChecks("healthui", new HealthCheckOptions { Predicate = _ => true, ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse });
-app.Lifetime.ApplicationStarted.Register(() =>
-{
- app.RegisterWithUptimeKumaAsync()
- .GetAwaiter()
- .GetResult();
-});
-
app.Run();
diff --git a/SecurityService/SecurityService.csproj b/SecurityService/SecurityService.csproj
index 369adc2..07c66a8 100644
--- a/SecurityService/SecurityService.csproj
+++ b/SecurityService/SecurityService.csproj
@@ -14,6 +14,7 @@
+
diff --git a/SecurityService/appsettings.json b/SecurityService/appsettings.json
index 9d82700..4305572 100644
--- a/SecurityService/appsettings.json
+++ b/SecurityService/appsettings.json
@@ -36,12 +36,23 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "UptimeKuma": {
- "Monitor": {
+ "HealthMonitoring": {
+ "Service": {
+ "ServiceId": "security-service",
"Name": "Security Service",
- "Url": "https://localhost:5001/health",
- "IntervalInSeconds": 60,
- "IgnoreTls": true
- }
+ "Description": "Security Service",
+ "HealthUrl": "https://localhost:5001/healthui",
+ "IgnoreCertificateErrors": true
+ },
+ "Dependencies": [
+ {
+ "DependencyName": "Messaging Service",
+ "TargetServiceId": "messaging-service"
+ },
+ {
+ "DependencyName": "database",
+ "TargetServiceId": "sql-server"
+ }
+ ]
}
}