Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Health Checks User Interface #174

Merged
merged 3 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,5 @@ __pycache__/
src/Volvox.Helios.Web/wwwroot/vendor.min.css
src/Volvox.Helios.Web/wwwroot/vendor.min.js
src/Volvox.Helios.Web/wwwroot/css/site.min.css
src/Volvox.Helios.Web/wwwroot/js/site.min.js
src/Volvox.Helios.Web/wwwroot/js/site.min.js
src/Volvox.Helios.Web/healthchecksdb
2 changes: 1 addition & 1 deletion src/Volvox.Helios.Service/VolvoxHeliosContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Volvox.Helios.Service
{
public class VolvoxHeliosContext : DbContext
{
public VolvoxHeliosContext(DbContextOptions options)
public VolvoxHeliosContext(DbContextOptions<VolvoxHeliosContext> options)
: base(options)
{
}
Expand Down
16 changes: 12 additions & 4 deletions src/Volvox.Helios.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
using Discord.WebSocket;
using Volvox.Helios.Core.Modules.Streamer;
using System.Data.SqlClient;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Volvox.Helios.Core.Modules.CleanChat;
using Volvox.Helios.Core.Modules.DadModule;
using HealthChecks.UI.Client;
using Hangfire.PostgreSql;

namespace Volvox.Helios.Web
Expand Down Expand Up @@ -183,7 +183,9 @@ public void ConfigureServices(IServiceCollection services)

// Health Checks
services.AddHealthChecks()
.AddSqlServer(Configuration["ConnectionStrings:VolvoxHeliosDatabase"]);
.AddSqlServer(Configuration["ConnectionStrings:VolvoxHeliosDatabase"], null, "HeliosDB");

services.AddHealthChecksUI();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down Expand Up @@ -225,7 +227,13 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, Vol
Activator = app.ApplicationServices.GetRequiredService<JobActivator>()
});

app.UseHealthChecks("/health");
app.UseHealthChecks("/health", new HealthCheckOptions()
{
Predicate = s => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});

app.UseHealthChecksUI();
}
}
}
1 change: 1 addition & 0 deletions src/Volvox.Helios.Web/Volvox.Helios.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.Discord" Version="2.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="2.2.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="2.2.33" />
<PackageReference Include="AWS.Logger.AspNetCore" Version="1.4.1" />
<PackageReference Include="AWS.Logger.Core" Version="1.3.1" />
<PackageReference Include="BuildBundlerMinifier" Version="2.8.391" />
Expand Down
10 changes: 10 additions & 0 deletions src/Volvox.Helios.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,15 @@
"Token": "DiscordToken",
"ClientID": "DiscordClientId",
"ClientSecret": "DiscordClientSecret"
},
"HealthChecksUI": {
"HealthChecks": [
{
"Name": "Volvox.Helios",
"Uri": "http://localhost:InsertPortHere/health"
}
],
"EvaluationTimeOnSeconds": "10",
"MinimumSecondsBetweenFailureNotifications" : "10"
}
}