Skip to content

Commit

Permalink
✨ Database Health Check (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattParkerDev authored Mar 15, 2024
1 parent fe698a7 commit 927d11b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/template-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Reusable Build and Deploy

on:
Expand Down
18 changes: 16 additions & 2 deletions SSW.Rules.GPT.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
.csharpierrc = .csharpierrc
global.json = global.json
.github\workflows\ssw-rulesgpt-prod.yml = .github\workflows\ssw-rulesgpt-prod.yml
.github\workflows\ssw-rulesgpt-stage.yml = .github\workflows\ssw-rulesgpt-stage.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DF971C14-AD50-4B07-ACED-087B6ECA7500}"
Expand All @@ -33,6 +31,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application.IntegrationTest
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "src\Shared\Shared.csproj", "{F86915AF-37EA-4B49-987A-3AE0978D1EBA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{2789B05B-CCB1-4D30-A5D8-A3C161E232C7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bicep", "bicep", "{0E648D68-2537-4917-805A-34E5228CF01B}"
ProjectSection(SolutionItems) = preProject
.github\bicep\main.bicep = .github\bicep\main.bicep
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{B66FAA72-B4E7-40BA-B85D-DAB617E3AE2E}"
ProjectSection(SolutionItems) = preProject
.github\workflows\main-build-deploy.yml = .github\workflows\main-build-deploy.yml
.github\workflows\stage-build-deploy.yml = .github\workflows\stage-build-deploy.yml
.github\workflows\template-build-deploy.yml = .github\workflows\template-build-deploy.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -87,5 +99,7 @@ Global
{BAE42F60-9354-4321-9A9A-A3F88D2C7236} = {D23E8309-9E03-4769-B6CC-2959CB36C8F5}
{8F5EA9E9-6B28-4308-B8D0-A0C28E05204D} = {D23E8309-9E03-4769-B6CC-2959CB36C8F5}
{F86915AF-37EA-4B49-987A-3AE0978D1EBA} = {DF971C14-AD50-4B07-ACED-087B6ECA7500}
{0E648D68-2537-4917-805A-34E5228CF01B} = {2789B05B-CCB1-4D30-A5D8-A3C161E232C7}
{B66FAA72-B4E7-40BA-B85D-DAB617E3AE2E} = {2789B05B-CCB1-4D30-A5D8-A3C161E232C7}
EndGlobalSection
EndGlobal
3 changes: 2 additions & 1 deletion src/WebAPI/DependencyInjection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Application.Contracts;
using Infrastructure;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging.ApplicationInsights;
Expand Down Expand Up @@ -96,7 +97,7 @@ public static IServiceCollection AddWebApi(
};
});

services.AddHealthChecks();
services.AddHealthChecks().AddDbContextCheck<RulesContext>();

return services;
}
Expand Down
2 changes: 1 addition & 1 deletion src/WebAPI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
app.MapConversationRoutes();
app.MapHub<RulesHub>("/ruleshub");

app.UseHealthChecks("/health");
app.MapHealthChecks("/health");

app.Logger.LogInformation("Starting WebAPI");
app.Run();
1 change: 1 addition & 0 deletions src/WebAPI/WebAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.3" />
<PackageReference Include="NSwag.MSBuild" Version="14.0.3">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 927d11b

Please sign in to comment.