Compare commits
3 Commits
995397e495
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a9bcd9b8c | |||
| fb733c27fd | |||
| 9f815f69c9 |
@@ -14,6 +14,8 @@ import (
|
|||||||
"github.com/jackc/pgx/v5/pgxpool"
|
"github.com/jackc/pgx/v5/pgxpool"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/health"
|
||||||
|
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
|
|
||||||
"github.com/metadata-agregator/internal/config"
|
"github.com/metadata-agregator/internal/config"
|
||||||
@@ -67,6 +69,7 @@ func main() {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
metadatav1.RegisterMetadataServiceServer(grpcServer, server.NewMetadataServer(services))
|
metadatav1.RegisterMetadataServiceServer(grpcServer, server.NewMetadataServer(services))
|
||||||
|
healthpb.RegisterHealthServer(grpcServer, health.NewServer())
|
||||||
reflection.Register(grpcServer)
|
reflection.Register(grpcServer)
|
||||||
|
|
||||||
srvMetrics.InitializeMetrics(grpcServer)
|
srvMetrics.InitializeMetrics(grpcServer)
|
||||||
|
|||||||
+31
@@ -5,6 +5,16 @@
|
|||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
server = pkgs.buildGoModule {
|
||||||
|
pname = "metadata-agregator";
|
||||||
|
version = "0.1.0";
|
||||||
|
src = ./.;
|
||||||
|
vendorHash = "sha256-iRG3hW7lQW1c9vIfpDs110AHeoq7N3KjyvJN9K0Sjos=";
|
||||||
|
subPackages = [ "cmd/server" ];
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
languages.go.enable = true;
|
languages.go.enable = true;
|
||||||
|
|
||||||
@@ -59,4 +69,25 @@
|
|||||||
GRANT ALL ON SCHEMA public TO agregator;
|
GRANT ALL ON SCHEMA public TO agregator;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
processes.metadata-agregator = {
|
||||||
|
exec = ''
|
||||||
|
export DATABASE_URL="postgresql://agregator:agregator@localhost/metadata_agregator?host=${config.env.PGHOST}"
|
||||||
|
cat > "$DEVENV_RUNTIME/metadata-config.yaml" <<'YAML'
|
||||||
|
server:
|
||||||
|
port: 50053
|
||||||
|
YAML
|
||||||
|
${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 = {
|
||||||
|
inherit server;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user