diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 0e6d98187..3334a326c 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -86,5 +86,7 @@ services: - OrderingUrl=http://ordering.api:5102/hc - BasketUrl=http://basket.api:5103/hc - IdentityUrl=http://10.0.75.1:5105/hc + - mvc=http://webmvc:5100/hc + - spa=http://webspa:5104/hc ports: - "5107:5107" diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index a205f7178..12faebcc0 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -40,7 +40,7 @@ services.AddHealthChecks(checks => { - checks.AddUrlCheck(Configuration["ConnectionString"]); + checks.AddUrlCheck(Configuration["ExternalCatalogBaseUrl"]); }); services.AddDbContext(c => diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 17628d25a..d619e4a21 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -57,6 +57,12 @@ + + + + + + Always diff --git a/src/Services/Identity/Identity.API/Program.cs b/src/Services/Identity/Identity.API/Program.cs index eb999639b..2f731c045 100644 --- a/src/Services/Identity/Identity.API/Program.cs +++ b/src/Services/Identity/Identity.API/Program.cs @@ -9,6 +9,7 @@ namespace eShopOnContainers.Identity { var host = new WebHostBuilder() .UseKestrel() + .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index d29459395..666ee67b9 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -17,6 +17,7 @@ using IdentityServer4.Services; using System.Threading; using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; using Microsoft.AspNetCore.Identity; +using Microsoft.Extensions.HealthChecks; 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. public void ConfigureServices(IServiceCollection services) - { + { + // Add framework services. services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); @@ -56,6 +58,11 @@ namespace eShopOnContainers.Identity services.AddMvc(); + services.AddHealthChecks(checks => + { + checks.AddSqlCheck("Identity_Db", Configuration.GetConnectionString("DefaultConnection")); + }); + services.AddTransient(); services.AddTransient(); services.AddTransient, EFLoginService>(); diff --git a/src/Services/Identity/Identity.API/appsettings.json b/src/Services/Identity/Identity.API/appsettings.json index 5a8c6d1fd..b41f05352 100644 --- a/src/Services/Identity/Identity.API/appsettings.json +++ b/src/Services/Identity/Identity.API/appsettings.json @@ -1,6 +1,6 @@ { "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", "SpaClient": "http://localhost:5104", diff --git a/src/Web/WebMVC/Program.cs b/src/Web/WebMVC/Program.cs index 6775c071c..654ae7677 100644 --- a/src/Web/WebMVC/Program.cs +++ b/src/Web/WebMVC/Program.cs @@ -9,6 +9,7 @@ namespace Microsoft.eShopOnContainers.WebMVC { var host = new WebHostBuilder() .UseKestrel() + .UseHealthChecks("/hc") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index ee2412bee..407b54668 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Http; using System.Threading; using Microsoft.Extensions.Options; using WebMVC.Services.Utilities; +using Microsoft.Extensions.HealthChecks; namespace Microsoft.eShopOnContainers.WebMVC { @@ -44,7 +45,12 @@ namespace Microsoft.eShopOnContainers.WebMVC { services.AddMvc(); services.Configure(Configuration); - + + services.AddHealthChecks(checks => + { + checks.AddUrlCheck(Configuration["CallBackUrl"]); + }); + // Add application services. services.AddSingleton(); services.AddTransient(); diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index e03f5e2c9..a2cea95c3 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -51,6 +51,12 @@ + + + + + + Always diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs index a0f33d8b3..163ccca04 100644 --- a/src/Web/WebSPA/Startup.cs +++ b/src/Web/WebSPA/Startup.cs @@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Newtonsoft.Json.Serialization; using eShopOnContainers.WebSPA; +using Microsoft.Extensions.HealthChecks; 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 public void ConfigureServices(IServiceCollection services) { + services.AddHealthChecks(checks => + { + checks.AddUrlCheck(Configuration["CallBackUrl"]); + }); + services.Configure(Configuration); services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN"); diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index 0d30295a7..e81a11d59 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -78,6 +78,12 @@ + + + + + + Always diff --git a/src/Web/WebSPA/appsettings.json b/src/Web/WebSPA/appsettings.json index ea2fed9ea..bcff6b46e 100644 --- a/src/Web/WebSPA/appsettings.json +++ b/src/Web/WebSPA/appsettings.json @@ -3,6 +3,7 @@ "OrderingUrl": "http://localhost:5102", "BasketUrl": "http://localhost:5103", "IdentityUrl": "http://localhost:5105", + "CallBackUrl": "http://localhost:5104/", "Logging": { "IncludeScopes": false, "LogLevel": { diff --git a/src/Web/WebStatus/Startup.cs b/src/Web/WebStatus/Startup.cs index 6bd5a119d..06416940c 100644 --- a/src/Web/WebStatus/Startup.cs +++ b/src/Web/WebStatus/Startup.cs @@ -35,8 +35,9 @@ namespace WebStatus checks.AddUrlCheckIfNotNull(Configuration["OrderingUrl"]); checks.AddUrlCheckIfNotNull(Configuration["BasketUrl"]); checks.AddUrlCheckIfNotNull(Configuration["CatalogUrl"]); + checks.AddUrlCheckIfNotNull(Configuration["IdentityUrl"]); checks.AddUrlCheckIfNotNull(Configuration["mvc"]); - checks.AddUrlCheckIfNotNull(Configuration["spa"]); + checks.AddUrlCheckIfNotNull(Configuration["spa"]); }); services.AddMvc(); } diff --git a/src/Web/WebStatus/Views/Home/Index.cshtml b/src/Web/WebStatus/Views/Home/Index.cshtml index d81f09bd8..a54bdcd41 100644 --- a/src/Web/WebStatus/Views/Home/Index.cshtml +++ b/src/Web/WebStatus/Views/Home/Index.cshtml @@ -7,14 +7,37 @@
-

Overall Status: @Model.OverallStatus

+

Overall Status: @Model.OverallStatus

-@foreach (var result in Model.Results) -{ -
-
@result.Description
-
@result.CheckStatus
-
-} +
+ @foreach (var result in Model.Results) + { +
+
+

@result.Data["url"]

+

@result.Description

+ +
+
+ @if (@result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Healthy) + { + @result.CheckStatus + } + else if (@result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Unhealthy) + { + @result.CheckStatus + } + else if (@result.CheckStatus == Microsoft.Extensions.HealthChecks.CheckStatus.Warning) + { + @result.CheckStatus + } + else + { + @result.CheckStatus + } +
+
+ } +
\ No newline at end of file diff --git a/src/Web/WebStatus/Views/Shared/_Layout.cshtml b/src/Web/WebStatus/Views/Shared/_Layout.cshtml index e9b750b37..a7eb2e3b6 100644 --- a/src/Web/WebStatus/Views/Shared/_Layout.cshtml +++ b/src/Web/WebStatus/Views/Shared/_Layout.cshtml @@ -41,11 +41,11 @@
@RenderBody() -
-
-

© 2017 - WebStatus

-
+
+

© 2017 - WebStatus

+
+ diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj index e5b1a0e77..47a3e20f0 100644 --- a/src/Web/WebStatus/WebStatus.csproj +++ b/src/Web/WebStatus/WebStatus.csproj @@ -1,10 +1,10 @@  - netcoreapp1.1 + 1.1.0 $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj diff --git a/src/Web/WebStatus/appsettings.json b/src/Web/WebStatus/appsettings.json index f7a4c68dd..06c5970b2 100644 --- a/src/Web/WebStatus/appsettings.json +++ b/src/Web/WebStatus/appsettings.json @@ -7,5 +7,6 @@ }, "OrderingUrl": "http://localhost:5102/hc", "BasketUrl": "http://localhost:5103/hc", - "CatalogUrl": "http://localhost:5101/hc" + "CatalogUrl": "http://localhost:5101/hc", + "IdentityUrl": "http://localhost:5105/hc" } diff --git a/src/Web/WebStatus/wwwroot/css/site.css b/src/Web/WebStatus/wwwroot/css/site.css index e31abdefd..ed02eb9be 100644 --- a/src/Web/WebStatus/wwwroot/css/site.css +++ b/src/Web/WebStatus/wwwroot/css/site.css @@ -35,3 +35,51 @@ textarea { 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; +} \ No newline at end of file