Fix gRPC health checks and add API Gateway Consul registration
Some checks failed
CI / Test (pull_request) Failing after 50s
CI / Lint (pull_request) Failing after 32s
CI / Build (pull_request) Successful in 17s
CI / Format Check (pull_request) Failing after 2s

- Fix gRPC health checks: Set serving status for default service (empty string) in all services
  - Consul checks the default service by default, not specific service names
  - All services now set both default and specific service status to SERVING

- Update Consul registration logic to automatically detect HTTP vs gRPC services
  - HTTP services (API Gateway) use HTTP health checks
  - gRPC services use gRPC health checks
  - Detection based on service tags and metadata

- Add API Gateway Consul registration
  - Register with Docker service name in Docker environment
  - Use HTTP health checks for API Gateway
  - Proper host/port configuration handling

- Add API Gateway HTTP-to-gRPC handlers
  - Implement service-specific handlers for Auth and Identity services
  - Translate HTTP requests to gRPC calls
  - Map gRPC error codes to HTTP status codes
This commit is contained in:
2025-11-06 22:04:55 +01:00
parent 04022b835e
commit 988adf6cc5
8 changed files with 610 additions and 66 deletions

View File

@@ -418,6 +418,9 @@ func provideIdentityService() fx.Option {
// Register health service
healthServer := health.NewServer()
grpc_health_v1.RegisterHealthServer(grpcServer, healthServer)
// Set serving status for the default service (empty string) - this is what Consul checks
healthServer.SetServingStatus("", grpc_health_v1.HealthCheckResponse_SERVING)
// Also set for the specific service name
healthServer.SetServingStatus("identity.v1.IdentityService", grpc_health_v1.HealthCheckResponse_SERVING)
// Register reflection for grpcurl