Skip to content

Commit fa54144

Browse files
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
1 parent dcd3057 commit fa54144

4 files changed

Lines changed: 17 additions & 5 deletions

File tree

docker-compose.override.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ services:
4444
- ASPNETCORE_URLS=http://0.0.0.0:5102
4545
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
4646
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
47+
- BasketUrl=http://basket.api:5103
4748
- EventBusConnection=rabbitmq
4849
ports:
4950
- "5102:5102"

docker-compose.prod.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
- ASPNETCORE_URLS=http://0.0.0.0:5103
2020
- ConnectionString=basket.data
2121
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
22+
- EventBusConnection=rabbitmq
2223
ports:
2324
- "5103:5103"
2425

@@ -28,6 +29,7 @@ services:
2829
- ASPNETCORE_URLS=http://0.0.0.0:5101
2930
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
3031
- 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.
32+
- EventBusConnection=rabbitmq
3133
ports:
3234
- "5101:5101"
3335

@@ -47,6 +49,8 @@ services:
4749
- ASPNETCORE_URLS=http://0.0.0.0:5102
4850
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
4951
- identityUrl=http://identity.api:5105 #Local: You need to open your host's firewall at range 5100-5105. at range 5100-5105.
52+
- BasketUrl=http://basket.api:5103
53+
- EventBusConnection=rabbitmq
5054
ports:
5155
- "5102:5102"
5256

@@ -81,10 +85,13 @@ services:
8185

8286
webstatus:
8387
environment:
84-
- ASPNETCORE_ENVIRONMENT=Development
88+
- ASPNETCORE_ENVIRONMENT=Production
89+
- ASPNETCORE_URLS=http://0.0.0.0:5107
8590
- CatalogUrl=http://catalog.api:5101/hc
8691
- OrderingUrl=http://ordering.api:5102/hc
8792
- BasketUrl=http://basket.api:5103/hc
88-
- IdentityUrl=http://10.0.75.1:5105/hc
93+
- mvc=http://webmvc:5100/hc
94+
- spa=http://webspa:5104/hc
95+
- 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.
8996
ports:
90-
- "5107:5107"
97+
- "5107:5107"

src/Services/Catalog/Catalog.API/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.IO;
2121
using System.Data.Common;
2222
using System.Reflection;
23+
using System.Threading.Tasks;
2324

2425
public class Startup
2526
{
@@ -48,7 +49,7 @@ public void ConfigureServices(IServiceCollection services)
4849

4950
services.AddHealthChecks(checks =>
5051
{
51-
checks.AddUrlCheck(Configuration["ExternalCatalogBaseUrl"]);
52+
checks.AddSqlCheck("Catalog_Db", Configuration["ConnectionString"]);
5253
});
5354

5455
services.AddMvc(options =>

src/Web/WebMVC/Startup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ public void ConfigureServices(IServiceCollection services)
4848

4949
services.AddHealthChecks(checks =>
5050
{
51-
checks.AddUrlCheck(Configuration["CallBackUrl"]);
51+
checks.AddUrlCheck(Configuration["CatalogUrl"]);
52+
checks.AddUrlCheck(Configuration["OrderingUrl"]);
53+
checks.AddUrlCheck(Configuration["BasketUrl"]);
54+
checks.AddUrlCheck(Configuration["IdentityUrl"]);
5255
});
5356

5457
// Add application services.

0 commit comments

Comments
 (0)