From fa541444c716423baa13eb33f2a41c06b451755e Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Thu, 30 Mar 2017 18:25:19 -0700 Subject: [PATCH] Fixed bug in HealthChecks so the Catalog.API microservice checks the SQL database. Also, added more UrlChecks to the MVC app so it checks all its dependencies. Plus minor bugs/missing code in docker-compose.pro.yml that was evolved in the .override.yml --- docker-compose.override.yml | 1 + docker-compose.prod.yml | 13 ++++++++++--- src/Services/Catalog/Catalog.API/Startup.cs | 3 ++- src/Web/WebMVC/Startup.cs | 5 ++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3334a326c..68a5521e2 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -44,6 +44,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:5102 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. + - BasketUrl=http://basket.api:5103 - EventBusConnection=rabbitmq ports: - "5102:5102" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 7e5c519e8..4d019d404 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -19,6 +19,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:5103 - ConnectionString=basket.data - identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - EventBusConnection=rabbitmq ports: - "5103:5103" @@ -28,6 +29,7 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:5101 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word - ExternalCatalogBaseUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5101 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - EventBusConnection=rabbitmq ports: - "5101:5101" @@ -47,6 +49,8 @@ services: - ASPNETCORE_URLS=http://0.0.0.0:5102 - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word - identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105. + - BasketUrl=http://basket.api:5103 + - EventBusConnection=rabbitmq ports: - "5102:5102" @@ -81,10 +85,13 @@ services: webstatus: environment: - - ASPNETCORE_ENVIRONMENT=Development + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://0.0.0.0:5107 - CatalogUrl=http://catalog.api:5101/hc - 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 + - IdentityUrl=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 #Local: Use ${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}, if using external IP or DNS name from browser. ports: - - "5107:5107" + - "5107:5107" \ No newline at end of file diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs index d49cc20be..b5b147989 100644 --- a/src/Services/Catalog/Catalog.API/Startup.cs +++ b/src/Services/Catalog/Catalog.API/Startup.cs @@ -20,6 +20,7 @@ using System.IO; using System.Data.Common; using System.Reflection; + using System.Threading.Tasks; public class Startup { @@ -48,7 +49,7 @@ services.AddHealthChecks(checks => { - checks.AddUrlCheck(Configuration["ExternalCatalogBaseUrl"]); + checks.AddSqlCheck("Catalog_Db", Configuration["ConnectionString"]); }); services.AddMvc(options => diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index e379041c4..aaba855d0 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -48,7 +48,10 @@ namespace Microsoft.eShopOnContainers.WebMVC services.AddHealthChecks(checks => { - checks.AddUrlCheck(Configuration["CallBackUrl"]); + checks.AddUrlCheck(Configuration["CatalogUrl"]); + checks.AddUrlCheck(Configuration["OrderingUrl"]); + checks.AddUrlCheck(Configuration["BasketUrl"]); + checks.AddUrlCheck(Configuration["IdentityUrl"]); }); // Add application services.