about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorYureka <tvl@yuka.dev>2024-07-22T13·41+0200
committerclbot <clbot@tvl.fyi>2024-07-22T15·57+0000
commit2547ff2cf6c6e8fefa6f55e3583bea1b1d8f4263 (patch)
treedfba0f40f8bdc91136b9dd9840b6872d9dca2219 /tvix
parent39c8b6dece1ca414f4ce8dde49e9828e34319664 (diff)
feat(tvix/store): add grpc healthcheck service to daemon r/8403
Change-Id: Ib95fc9352a45d54f9a16c8841c7e8f7cbeeaee8c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12019
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: yuka <yuka@yuka.dev>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/Cargo.lock14
-rw-r--r--tvix/Cargo.nix53
-rw-r--r--tvix/store/Cargo.toml1
-rw-r--r--tvix/store/src/bin/tvix-store.rs3
4 files changed, 71 insertions, 0 deletions
diff --git a/tvix/Cargo.lock b/tvix/Cargo.lock
index 2c67116cd83c..5d5208b7e2d8 100644
--- a/tvix/Cargo.lock
+++ b/tvix/Cargo.lock
@@ -4527,6 +4527,19 @@ dependencies = [
 ]
 
 [[package]]
+name = "tonic-health"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1e10e6a96ee08b6ce443487d4368442d328d0e746f3681f81127f7dc41b4955"
+dependencies = [
+ "async-stream",
+ "prost 0.13.1",
+ "tokio",
+ "tokio-stream",
+ "tonic 0.12.1",
+]
+
+[[package]]
 name = "tonic-reflection"
 version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5001,6 +5014,7 @@ dependencies = [
  "toml 0.8.15",
  "tonic 0.12.1",
  "tonic-build 0.12.1",
+ "tonic-health",
  "tonic-reflection",
  "tower",
  "tower-http",
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix
index 12d111bed17f..64d0adabfdd4 100644
--- a/tvix/Cargo.nix
+++ b/tvix/Cargo.nix
@@ -14489,6 +14489,54 @@ rec {
         };
         resolvedDefaultFeatures = [ "default" "prost" "prost-build" "transport" ];
       };
+      "tonic-health" = rec {
+        crateName = "tonic-health";
+        version = "0.12.1";
+        edition = "2021";
+        sha256 = "0ma93g27szqjh4gniws6wz82ils2hhvd91rl8k7bc27fjrm0xqg1";
+        authors = [
+          "James Nugent <james@jen20.com>"
+        ];
+        dependencies = [
+          {
+            name = "async-stream";
+            packageId = "async-stream";
+          }
+          {
+            name = "prost";
+            packageId = "prost 0.13.1";
+          }
+          {
+            name = "tokio";
+            packageId = "tokio";
+            features = [ "sync" ];
+          }
+          {
+            name = "tokio-stream";
+            packageId = "tokio-stream";
+          }
+          {
+            name = "tonic";
+            packageId = "tonic 0.12.1";
+            usesDefaultFeatures = false;
+            features = [ "codegen" "prost" ];
+          }
+        ];
+        devDependencies = [
+          {
+            name = "tokio";
+            packageId = "tokio";
+            features = [ "rt-multi-thread" "macros" ];
+          }
+          {
+            name = "tokio-stream";
+            packageId = "tokio-stream";
+          }
+        ];
+        features = {
+          "default" = [ "transport" ];
+        };
+      };
       "tonic-reflection" = rec {
         crateName = "tonic-reflection";
         version = "0.12.1";
@@ -16428,6 +16476,11 @@ rec {
             features = [ "tls" "tls-roots" ];
           }
           {
+            name = "tonic-health";
+            packageId = "tonic-health";
+            usesDefaultFeatures = false;
+          }
+          {
             name = "tonic-reflection";
             packageId = "tonic-reflection";
             optional = true;
diff --git a/tvix/store/Cargo.toml b/tvix/store/Cargo.toml
index e70ed0e39674..964fc9be2e1a 100644
--- a/tvix/store/Cargo.toml
+++ b/tvix/store/Cargo.toml
@@ -44,6 +44,7 @@ tracing = "0.1.40"
 tracing-indicatif = "0.3.6"
 hyper-util = "0.1.6"
 toml = { version = "0.8.15", optional = true }
+tonic-health = { version = "0.12.1", default-features = false }
 
 [dependencies.tonic-reflection]
 optional = true
diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs
index 5401f67b3f7e..37e1672c79df 100644
--- a/tvix/store/src/bin/tvix-store.rs
+++ b/tvix/store/src/bin/tvix-store.rs
@@ -178,8 +178,11 @@ async fn run_cli(cli: Cli) -> Result<(), Box<dyn std::error::Error + Send + Sync
                     .map_request(tvix_tracing::propagate::tonic::accept_trace),
             );
 
+            let (_health_reporter, health_service) = tonic_health::server::health_reporter();
+
             #[allow(unused_mut)]
             let mut router = server
+                .add_service(health_service)
                 .add_service(BlobServiceServer::new(GRPCBlobServiceWrapper::new(
                     blob_service,
                 )))