Added MVC and SPA Apps to healthChecker
Added styles to view
This commit is contained in:
parent
561ba3b1ec
commit
e08fe895a3
@ -86,5 +86,7 @@ services:
|
|||||||
- OrderingUrl=http://ordering.api:5102/hc
|
- OrderingUrl=http://ordering.api:5102/hc
|
||||||
- BasketUrl=http://basket.api:5103/hc
|
- BasketUrl=http://basket.api:5103/hc
|
||||||
- IdentityUrl=http://10.0.75.1:5105/hc
|
- IdentityUrl=http://10.0.75.1:5105/hc
|
||||||
|
- mvc=http://webmvc:5100/hc
|
||||||
|
- spa=http://webspa:5104/hc
|
||||||
ports:
|
ports:
|
||||||
- "5107:5107"
|
- "5107:5107"
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
services.AddHealthChecks(checks =>
|
services.AddHealthChecks(checks =>
|
||||||
{
|
{
|
||||||
checks.AddUrlCheck(Configuration["ConnectionString"]);
|
checks.AddUrlCheck(Configuration["ExternalCatalogBaseUrl"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddDbContext<CatalogContext>(c =>
|
services.AddDbContext<CatalogContext>(c =>
|
||||||
|
@ -57,6 +57,12 @@
|
|||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.Data\Microsoft.Extensions.HealthChecks.Data.csproj" />
|
||||||
|
<ProjectReference Include="..\..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Dockerfile">
|
<None Update="Dockerfile">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
@ -9,6 +9,7 @@ namespace eShopOnContainers.Identity
|
|||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
|
.UseHealthChecks("/hc")
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
.UseIISIntegration()
|
.UseIISIntegration()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
|
@ -17,6 +17,7 @@ using IdentityServer4.Services;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.Extensions.HealthChecks;
|
||||||
|
|
||||||
namespace eShopOnContainers.Identity
|
namespace eShopOnContainers.Identity
|
||||||
{
|
{
|
||||||
@ -43,7 +44,8 @@ namespace eShopOnContainers.Identity
|
|||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Add framework services.
|
// Add framework services.
|
||||||
services.AddDbContext<ApplicationDbContext>(options =>
|
services.AddDbContext<ApplicationDbContext>(options =>
|
||||||
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
|
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
|
||||||
@ -56,6 +58,11 @@ namespace eShopOnContainers.Identity
|
|||||||
|
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
|
services.AddHealthChecks(checks =>
|
||||||
|
{
|
||||||
|
checks.AddSqlCheck("Identity_Db", Configuration.GetConnectionString("DefaultConnection"));
|
||||||
|
});
|
||||||
|
|
||||||
services.AddTransient<IEmailSender, AuthMessageSender>();
|
services.AddTransient<IEmailSender, AuthMessageSender>();
|
||||||
services.AddTransient<ISmsSender, AuthMessageSender>();
|
services.AddTransient<ISmsSender, AuthMessageSender>();
|
||||||
services.AddTransient<ILoginService<ApplicationUser>, EFLoginService>();
|
services.AddTransient<ILoginService<ApplicationUser>, EFLoginService>();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"DefaultConnection": "Server=127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word"
|
"DefaultConnection": "Server=tcp:127.0.0.1,5433;Database=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word;"
|
||||||
},
|
},
|
||||||
"MvcClient": "http://localhost:5100",
|
"MvcClient": "http://localhost:5100",
|
||||||
"SpaClient": "http://localhost:5104",
|
"SpaClient": "http://localhost:5104",
|
||||||
|
@ -9,6 +9,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
|
.UseHealthChecks("/hc")
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
.UseIISIntegration()
|
.UseIISIntegration()
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
|
@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using WebMVC.Services.Utilities;
|
using WebMVC.Services.Utilities;
|
||||||
|
using Microsoft.Extensions.HealthChecks;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC
|
namespace Microsoft.eShopOnContainers.WebMVC
|
||||||
{
|
{
|
||||||
@ -44,7 +45,12 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
{
|
{
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
|
|
||||||
|
services.AddHealthChecks(checks =>
|
||||||
|
{
|
||||||
|
checks.AddUrlCheck(Configuration["CallBackUrl"]);
|
||||||
|
});
|
||||||
|
|
||||||
// Add application services.
|
// Add application services.
|
||||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||||
services.AddTransient<ICatalogService, CatalogService>();
|
services.AddTransient<ICatalogService, CatalogService>();
|
||||||
|
@ -51,6 +51,12 @@
|
|||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.Data\Microsoft.Extensions.HealthChecks.Data.csproj" />
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Dockerfile">
|
<None Update="Dockerfile">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using eShopOnContainers.WebSPA;
|
using eShopOnContainers.WebSPA;
|
||||||
|
using Microsoft.Extensions.HealthChecks;
|
||||||
|
|
||||||
namespace eShopConContainers.WebSPA
|
namespace eShopConContainers.WebSPA
|
||||||
{
|
{
|
||||||
@ -39,6 +40,11 @@ namespace eShopConContainers.WebSPA
|
|||||||
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
|
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.AddHealthChecks(checks =>
|
||||||
|
{
|
||||||
|
checks.AddUrlCheck(Configuration["CallBackUrl"]);
|
||||||
|
});
|
||||||
|
|
||||||
services.Configure<AppSettings>(Configuration);
|
services.Configure<AppSettings>(Configuration);
|
||||||
|
|
||||||
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
|
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
|
||||||
|
@ -78,6 +78,12 @@
|
|||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.AspNetCore.HealthChecks\Microsoft.AspNetCore.HealthChecks.csproj" />
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks.Data\Microsoft.Extensions.HealthChecks.Data.csproj" />
|
||||||
|
<ProjectReference Include="..\..\BuildingBlocks\HealthChecks\src\Microsoft.Extensions.HealthChecks\Microsoft.Extensions.HealthChecks.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Dockerfile">
|
<None Update="Dockerfile">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
"OrderingUrl": "http://localhost:5102",
|
"OrderingUrl": "http://localhost:5102",
|
||||||
"BasketUrl": "http://localhost:5103",
|
"BasketUrl": "http://localhost:5103",
|
||||||
"IdentityUrl": "http://localhost:5105",
|
"IdentityUrl": "http://localhost:5105",
|
||||||
|
"CallBackUrl": "http://localhost:5104/",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
@ -35,8 +35,9 @@ namespace WebStatus
|
|||||||
checks.AddUrlCheckIfNotNull(Configuration["OrderingUrl"]);
|
checks.AddUrlCheckIfNotNull(Configuration["OrderingUrl"]);
|
||||||
checks.AddUrlCheckIfNotNull(Configuration["BasketUrl"]);
|
checks.AddUrlCheckIfNotNull(Configuration["BasketUrl"]);
|
||||||
checks.AddUrlCheckIfNotNull(Configuration["CatalogUrl"]);
|
checks.AddUrlCheckIfNotNull(Configuration["CatalogUrl"]);
|
||||||
|
checks.AddUrlCheckIfNotNull(Configuration["IdentityUrl"]);
|
||||||
checks.AddUrlCheckIfNotNull(Configuration["mvc"]);
|
checks.AddUrlCheckIfNotNull(Configuration["mvc"]);
|
||||||
checks.AddUrlCheckIfNotNull(Configuration["spa"]);
|
checks.AddUrlCheckIfNotNull(Configuration["spa"]);
|
||||||
});
|
});
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,37 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<h2>Overall Status: @Model.OverallStatus</h2>
|
<h2 class="overall-status-title">Overall Status: @Model.OverallStatus</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach (var result in Model.Results)
|
<div class="list-group-status">
|
||||||
{
|
@foreach (var result in Model.Results)
|
||||||
<div class="row">
|
{
|
||||||
<div class="col-md-6">@result.Description</div>
|
<div class="row list-group-status-item">
|
||||||
<div class="col-md-6">@result.CheckStatus</div>
|
<div class="col-md-10">
|
||||||
</div>
|
<h4 class="list-group-status-item-title">@result.Data["url"]</h4>
|
||||||
}
|
<p class="list-group-item-text">@result.Description</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2 list-group-status-item-label">
|
||||||
|
@if (@result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Healthy)
|
||||||
|
{
|
||||||
|
<span class="label label-success">@result.CheckStatus</span>
|
||||||
|
}
|
||||||
|
else if (@result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Unhealthy)
|
||||||
|
{
|
||||||
|
<span class="label label-danger">@result.CheckStatus</span>
|
||||||
|
}
|
||||||
|
else if (@result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Warning)
|
||||||
|
{
|
||||||
|
<span class="label label-warning">@result.CheckStatus</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="label label-default">@result.CheckStatus</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
@ -41,11 +41,11 @@
|
|||||||
</nav>
|
</nav>
|
||||||
<div class="container body-content">
|
<div class="container body-content">
|
||||||
@RenderBody()
|
@RenderBody()
|
||||||
<hr />
|
|
||||||
<footer>
|
|
||||||
<p>© 2017 - WebStatus</p>
|
|
||||||
</footer>
|
|
||||||
</div>
|
</div>
|
||||||
|
<footer class="container footer">
|
||||||
|
<p class="center">© 2017 - WebStatus</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
|
||||||
<environment names="Development">
|
<environment names="Development">
|
||||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>
|
||||||
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
|
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
|
||||||
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -7,5 +7,6 @@
|
|||||||
},
|
},
|
||||||
"OrderingUrl": "http://localhost:5102/hc",
|
"OrderingUrl": "http://localhost:5102/hc",
|
||||||
"BasketUrl": "http://localhost:5103/hc",
|
"BasketUrl": "http://localhost:5103/hc",
|
||||||
"CatalogUrl": "http://localhost:5101/hc"
|
"CatalogUrl": "http://localhost:5101/hc",
|
||||||
|
"IdentityUrl": "http://localhost:5105/hc"
|
||||||
}
|
}
|
||||||
|
@ -35,3 +35,51 @@ textarea {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.overall-status-title {
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-group-status {
|
||||||
|
max-width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-group-status-item {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
padding: 10px 15px;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-group-status-item:first-child {
|
||||||
|
border-top-left-radius: 8px;
|
||||||
|
border-top-right-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-group-status-item:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
border-bottom-right-radius: 8px;
|
||||||
|
border-bottom-left-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-group-status-item-title {
|
||||||
|
color: dodgerblue;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-group-status-item-label {
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 60px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user