Skip to content

Commit

Permalink
healt check ui added 🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
Oğuzhan Aydın committed Apr 29, 2021
1 parent 3868c2b commit 49d9853
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ The user adds their products to the basket during shopping and creates an order.

# Screenshots

## Healthcheck UI
![](img/healtcheck-screenshot.png)

## Order Api

![](img/order-api-screenshot.png)
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ services:
- PORT=80
- IdentityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOPZERO_EXTERNAL_DNS_NAME_OR_IP}:5201
- EventBusConnection=rabbitmq
- EventBusUserName=${ESHOPZERO_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOPZERO_SERVICE_BUS_PASSWORD}
- ConnectionString=User ID=eshopzero;Password=7eeb43dedd28b53b69f7cd74505b3457;Server=postgresdata;Database=eshopzero.order;Integrated Security=true;Pooling=true
Expand All @@ -78,6 +79,8 @@ services:
- PORT=80
- IdentityUrl=http://identity-api
- IdentityUrlExternal=http://${ESHOPZERO_EXTERNAL_DNS_NAME_OR_IP}:5201
- RedisConnection=redis
- EventBusConnection=rabbitmq
- EventBusUserName=${ESHOPZERO_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOPZERO_SERVICE_BUS_PASSWORD}
- ConnectionString=User ID=eshopzero;Password=7eeb43dedd28b53b69f7cd74505b3457;Server=postgresdata;Database=eshopzero.product;Integrated Security=true;Pooling=true
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ services:
- identity-api
- order-api
- product-api
- postgresdata
- rabbitmq
- redis

identity-api:
image: ${DOCKER_REGISTRY-}eshopzero/identity-api:${TAG:-latest}
Expand All @@ -47,6 +50,7 @@ services:
- identity-api
- postgresdata
- rabbitmq
- redis

order-api:
image: ${DOCKER_REGISTRY-}eshopzero/order-api:${TAG:-latest}
Expand Down
10 changes: 8 additions & 2 deletions gateway/Gateway/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ public static IServiceCollection AddCustomAuthentication(this IServiceCollection

public static void AddCustomHealthCheck(this IServiceCollection services, IConfiguration configuration)
{
services.AddHealthChecksUI(setup => setup.DisableDatabaseMigrations())
.AddInMemoryStorage();
services.AddHealthChecks()
.AddCheck("self", () => HealthCheckResult.Healthy())
.AddUrlGroup(new Uri(configuration["OrderUrlHC"]), name: "orderapi-check", tags: new[] { "orderapi" })
.AddUrlGroup(new Uri(configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new[] { "identityapi" })
.AddUrlGroup(new Uri(configuration["ProductUrlHC"]), name: "productapi-check", tags: new[] { "productapi" });

services.AddHealthChecksUI(setupSettings: setup =>
{
setup.AddHealthCheckEndpoint("Order Api Healthcheck", configuration["OrderUrlHC"]);
setup.AddHealthCheckEndpoint("Product Api Healthcheck", configuration["ProductUrlHC"]);
setup.AddHealthCheckEndpoint("Identity Healthcheck", configuration["IdentityUrlHC"]);
setup.DisableDatabaseMigrations();
}).AddInMemoryStorage();
}
}
}
3 changes: 2 additions & 1 deletion gateway/Gateway/Gateway.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Uris" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="Ocelot" Version="17.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.0.1" />
Expand Down
Binary file added img/healtcheck-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ public static IServiceCollection AddCustomHealtCheck(this IServiceCollection ser
.AddCheck("self", () => HealthCheckResult.Healthy())
.AddNpgSql(configuration["ConnectionString"],
name: "OrderDB-check",
tags: new[] { "OrderDB" });
tags: new[] { "OrderDB" })
.AddRabbitMQ(
$"amqp://{configuration["EventBusConnection"]}",
name: "order-rabbitmqbus-check",
tags: new[] { "rabbitmqbus" });

return services;
}
Expand Down
7 changes: 3 additions & 4 deletions services/order/Order.Test/Application/OrderQueryTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using Moq;
using Order.Api.Application.Queries;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Castle.DynamicProxy.Generators.Emitters.SimpleAST;
using Moq;
using Order.Api.Application.Queries;
using Xunit;
using Zero.Core.Repositories;
using Zero.Core.Sessions;
Expand Down
1 change: 1 addition & 0 deletions services/product/Product.Api/Product.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="5.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.Rabbitmq" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="Autofac" Version="6.2.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,14 @@ public static IServiceCollection AddCustomHealtCheck(this IServiceCollection ser
.AddCheck("self", () => HealthCheckResult.Healthy())
.AddNpgSql(configuration["ConnectionString"],
name: "productDB-check",
tags: new[] { "OrderDB" });
tags: new[] { "OrderDB" })
.AddRabbitMQ(
$"amqp://{configuration["EventBusConnection"]}",
name: "order-rabbitmqbus-check",
tags: new[] { "rabbitmqbus" })
.AddRedis(configuration["RedisConnection"],
name: "redis-check",
tags: new[] { "redis" });

return services;
}
Expand Down

0 comments on commit 49d9853

Please sign in to comment.