Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander 6a9bcd9b8c Add readiness probe to devenv 2026-07-25 12:44:14 +02:00
Alexander fb733c27fd Add health endpoint 2026-07-17 17:56:54 +02:00
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -14,6 +14,8 @@ import (
"github.com/jackc/pgx/v5/pgxpool"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
"google.golang.org/grpc/health"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
"github.com/metadata-agregator/internal/config"
@@ -67,6 +69,7 @@ func main() {
),
)
metadatav1.RegisterMetadataServiceServer(grpcServer, server.NewMetadataServer(services))
healthpb.RegisterHealthServer(grpcServer, health.NewServer())
reflection.Register(grpcServer)
srvMetrics.InitializeMetrics(grpcServer)
+6 -1
View File
@@ -11,7 +11,7 @@ let
pname = "metadata-agregator";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-qNNFHRKqGoo/GveSl9+Bm+DkTKDoSQeGtG8p1edmCJk=";
vendorHash = "sha256-iRG3hW7lQW1c9vIfpDs110AHeoq7N3KjyvJN9K0Sjos=";
subPackages = [ "cmd/server" ];
};
in
@@ -80,6 +80,11 @@ in
${config.outputs.server}/bin/server -config "$DEVENV_RUNTIME/metadata-config.yaml"
'';
after = [ "devenv:processes:postgres" ];
# Probes the standard gRPC Health Checking Protocol (cmd/server/main.go
# registers google.golang.org/grpc/health + reflection). Port matches
# server.port in the YAML above. SERVING means the gRPC server is
# accepting connections; postgres readiness is already gated by `after`.
ready.exec = "grpcurl -plaintext -max-time 2 localhost:50053 grpc.health.v1.Health/Check | grep -q SERVING";
};
outputs = {