Browse Source

Health check for Payment

pull/320/head
Igor Sychev 7 years ago
committed by Igor Sychev
parent
commit
926cc9f5e5
5 changed files with 12 additions and 2 deletions
  1. +1
    -0
      docker-compose.override.yml
  2. +1
    -1
      src/Services/Payment/Payment.API/Program.cs
  3. +7
    -0
      src/Services/Payment/Payment.API/Startup.cs
  4. +1
    -0
      src/Web/WebStatus/Startup.cs
  5. +2
    -1
      src/Web/WebStatus/appsettings.json

+ 1
- 0
docker-compose.override.yml View File

@ -137,6 +137,7 @@ services:
- IdentityUrl=http://identity.api/hc
- LocationsUrl=http://locations.api/hc
- MarketingUrl=http://marketing.api/hc
- PaymentUrl=http://payment.api/hc
- mvc=http://webmvc/hc
- spa=http://webspa/hc
ports:


+ 1
- 1
src/Services/Payment/Payment.API/Program.cs View File

@ -15,7 +15,7 @@ namespace Payment.API
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, builder) =>


+ 7
- 0
src/Services/Payment/Payment.API/Startup.cs View File

@ -9,11 +9,13 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.HealthChecks;
using Microsoft.Extensions.Logging;
using Payment.API.IntegrationEvents.EventHandling;
using Payment.API.IntegrationEvents.Events;
using RabbitMQ.Client;
using System;
using System.Threading.Tasks;
namespace Payment.API
{
@ -70,6 +72,11 @@ namespace Payment.API
});
}
services.AddHealthChecks(checks =>
{
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
});
RegisterEventBus(services);
services.AddSwaggerGen(options =>


+ 1
- 0
src/Web/WebStatus/Startup.cs View File

@ -40,6 +40,7 @@ namespace WebStatus
checks.AddUrlCheckIfNotNull(Configuration["IdentityUrl"], TimeSpan.FromMinutes(minutes));
checks.AddUrlCheckIfNotNull(Configuration["LocationsUrl"], TimeSpan.FromMinutes(minutes));
checks.AddUrlCheckIfNotNull(Configuration["MarketingUrl"], TimeSpan.FromMinutes(minutes));
checks.AddUrlCheckIfNotNull(Configuration["PaymentUrl"], TimeSpan.FromMinutes(minutes));
checks.AddUrlCheckIfNotNull(Configuration["mvc"], TimeSpan.FromMinutes(minutes));
checks.AddUrlCheckIfNotNull(Configuration["spa"], TimeSpan.FromMinutes(minutes));
});


+ 2
- 1
src/Web/WebStatus/appsettings.json View File

@ -10,5 +10,6 @@
"CatalogUrl": "http://localhost:5101/hc",
"IdentityUrl": "http://localhost:5105/hc",
"MarketingUrl": "http://localhost:5110/hc",
"LocationsUrl": "http://localhost:5109/hc"
"LocationsUrl": "http://localhost:5109/hc",
"PaymentUrl": "http://localhost:5108/hc"
}

Loading…
Cancel
Save