Some checks failed
v2-ci / build (push) Failing after 32s
v2-ci / unit-tests (tests/Core/ZB.MOM.WW.OtOpcUa.Cluster.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.ControlPlane.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Runtime.Tests) (push) Has been skipped
v2-ci / unit-tests (tests/Server/ZB.MOM.WW.OtOpcUa.Security.Tests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.Host.IntegrationTests) (push) Has been skipped
v2-ci / integration (tests/Server/ZB.MOM.WW.OtOpcUa.OpcUaServer.IntegrationTests) (push) Has been skipped
Two fixes surfaced while bringing up the docker-dev stack end-to-end:
- HealthEndpoints.MapOtOpcUaHealth now calls .AllowAnonymous() on /health/ready,
/health/active, /healthz. Without it the AddOtOpcUaAuth fallback policy 401s
every probe and Traefik marks every backend unhealthy → all three cluster
routes return 503.
- cluster-seed entrypoint no longer attempts to apply Migrate-To-V2.sql via
sqlcmd. The EF-generated idempotent script puts CREATE PROCEDURE inside
IF NOT EXISTS BEGIN ... END blocks (procs must be first in their batch),
so sqlcmd fails with "Must declare the scalar variable @FromGenerationId".
EF's own runner handles this; sqlcmd doesn't. The seed now just waits for
the schema and applies row inserts. Migrations remain the operator's job:
dotnet ef database update --project src/Core/.../Configuration \
--startup-project src/Server/.../Host
Also: LDAP service removed (bitnami/openldap:2.6 image retired, legacy tag
crashes mid-setup with exit 68); every host now runs with
Authentication__Ldap__DevStubMode=true. Bumped LDAP+Traefik dashboard host
ports to avoid collisions with the sister scadalink dev stack (3893→3894,
8080→8089).
Confirmed working end-to-end: all three Traefik routes return HTTP 200,
cluster-seed populates ServerCluster (MAIN/SITE-A/SITE-B) + ClusterNode
(driver-a/b, site-a-1/2, site-b-1/2) rows on first boot.
45 lines
1.9 KiB
C#
45 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
|
using Microsoft.AspNetCore.Routing;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
|
|
|
namespace ZB.MOM.WW.OtOpcUa.Host.Health;
|
|
|
|
public static class HealthEndpoints
|
|
{
|
|
/// <summary>
|
|
/// Registers the standard ASP.NET Core health-check infrastructure plus the OtOpcUa-specific
|
|
/// probes. Mirrors ScadaLink's three-tier pattern: <c>ready</c> = boot ok; <c>active</c> =
|
|
/// fully serving traffic; <c>healthz</c> = bare process liveness.
|
|
/// </summary>
|
|
public static IServiceCollection AddOtOpcUaHealth(this IServiceCollection services)
|
|
{
|
|
services.AddHealthChecks()
|
|
.AddCheck<DatabaseHealthCheck>("configdb", tags: new[] { "ready", "active" })
|
|
.AddCheck<AkkaClusterHealthCheck>("akka", tags: new[] { "ready", "active" })
|
|
.AddCheck<AdminRoleLeaderHealthCheck>("admin-leader", tags: new[] { "active" });
|
|
return services;
|
|
}
|
|
|
|
public static IEndpointRouteBuilder MapOtOpcUaHealth(this IEndpointRouteBuilder app)
|
|
{
|
|
// AllowAnonymous on all three — Traefik / k8s liveness probes / load-balancers
|
|
// hit these without credentials. Without it the AddOtOpcUaAuth fallback policy
|
|
// 401s every probe and Traefik marks every backend unhealthy.
|
|
app.MapHealthChecks("/health/ready", new HealthCheckOptions
|
|
{
|
|
Predicate = c => c.Tags.Contains("ready"),
|
|
}).AllowAnonymous();
|
|
app.MapHealthChecks("/health/active", new HealthCheckOptions
|
|
{
|
|
Predicate = c => c.Tags.Contains("active"),
|
|
}).AllowAnonymous();
|
|
app.MapHealthChecks("/healthz", new HealthCheckOptions
|
|
{
|
|
Predicate = _ => false, // process-liveness only — no probes run.
|
|
}).AllowAnonymous();
|
|
return app;
|
|
}
|
|
}
|