From c18a6a58174642ca88ef23e10f7ba0ae64eb2a5d Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Mon, 25 Aug 2025 12:39:59 +0000 Subject: [PATCH 1/2] grpc-health-probe: init at 0.4.40 --- pkgs/by-name/gr/grpc-health-probe/package.nix | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pkgs/by-name/gr/grpc-health-probe/package.nix diff --git a/pkgs/by-name/gr/grpc-health-probe/package.nix b/pkgs/by-name/gr/grpc-health-probe/package.nix new file mode 100644 index 000000000000..cb140c3e492e --- /dev/null +++ b/pkgs/by-name/gr/grpc-health-probe/package.nix @@ -0,0 +1,27 @@ +{ + buildGoModule, + lib, + fetchFromGitHub, +}: + +buildGoModule rec { + pname = "grpc-health-probe"; + version = "0.4.40"; + + src = fetchFromGitHub { + owner = "grpc-ecosystem"; + repo = "grpc-health-probe"; + rev = "v${version}"; + hash = "sha256-Na0y8fL109flHGJOniEpLgs60xf1V0YlSBrX9iHtymM="; + }; + + vendorHash = "sha256-eIjDs14PEzoVaRYoxN03pDfYzg4VF1tgskLY9oIkMLE="; + + meta = with lib; { + description = "command-line tool to perform health-checks for gRPC applications"; + homepage = "https://github.com/grpc-ecosystem/grpc-health-probe"; + license = licenses.asl20; + maintainers = with maintainers; [ jpds ]; + mainProgram = "grpc-health-probe"; + }; +} From f704eef1c3d7167c95ea935c7dca71e8d02f2da5 Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Mon, 25 Aug 2025 12:54:57 +0000 Subject: [PATCH 2/2] nixos/thanos: Add check for serving gRPC port --- nixos/tests/thanos.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nixos/tests/thanos.nix b/nixos/tests/thanos.nix index caadfaa37c2c..d1ba83868bbc 100644 --- a/nixos/tests/thanos.nix +++ b/nixos/tests/thanos.nix @@ -42,7 +42,10 @@ in { virtualisation.diskSize = 2 * 1024; virtualisation.memorySize = 2048; - environment.systemPackages = [ pkgs.jq ]; + environment.systemPackages = [ + pkgs.grpc-health-probe + pkgs.jq + ]; networking.firewall.allowedTCPPorts = [ grpcPort ]; services.prometheus = { enable = true; @@ -178,6 +181,7 @@ in virtualisation.diskSize = 2 * 1024; virtualisation.memorySize = 2048; environment.systemPackages = with pkgs; [ + grpc-health-probe jq thanos ]; @@ -251,6 +255,13 @@ in prometheus.wait_for_open_port(${toString queryPort}) prometheus.succeed("curl -sf http://127.0.0.1:${toString queryPort}/metrics") + prometheus.wait_until_succeeds("journalctl -o cat -u thanos-sidecar.service | grep 'listening for serving gRPC'") + + store.wait_until_succeeds("journalctl -o cat -u thanos-store.service | grep 'listening for serving gRPC'") + + for machine in prometheus, store: + machine.wait_until_succeeds("grpc-health-probe -addr 127.0.0.1:${toString grpcPort}") + # Let's test if pushing a metric to the pushgateway succeeds: prometheus.wait_for_unit("pushgateway.service") prometheus.succeed(