From fc317070b5a32d0e83b20caf99dfd81ce671cb4c Mon Sep 17 00:00:00 2001 From: Conor Schaefer Date: Wed, 31 Jul 2024 14:20:19 -0700 Subject: [PATCH] feat(dev): add grpcui to nix dev env Adds a version of grpcui to the local nix dev env. Includes logic to build the go binary from source, via nix, because the released version of grpcui upstream still uses the old v1alpha reflection API, which is incompatible with current versions of `pd`. Refs #4392. --- .../compose/process-compose-dev-tooling.yml | 25 +++++++++++++++ flake.nix | 31 +++++++++++++++++++ justfile | 3 +- 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 deployments/compose/process-compose-dev-tooling.yml diff --git a/deployments/compose/process-compose-dev-tooling.yml b/deployments/compose/process-compose-dev-tooling.yml new file mode 100644 index 0000000000..a68a29cfea --- /dev/null +++ b/deployments/compose/process-compose-dev-tooling.yml @@ -0,0 +1,25 @@ +--- +# A process-compose configuration for running a dev-centric debugging and introspection +# tooling for Penumbra, such as gRPC UI, for exploring protobuf interfaces. +version: "0.5" +log_level: info +is_strict: true + +processes: + # Run gRPC UI for interactive protobuf exploration in a web UI: http://localhost:8100 + grpcui: + command: grpcui -v -open-browser=false -port 8100 -plaintext localhost:8080 + readiness_probe: + http_get: + host: 127.0.0.1 + scheme: http + path: "/" + port: 8100 + initial_delay_seconds: 10 + period_seconds: 5 + failure_threshold: 3 + availability: + restart: exit_on_failure + depends_on: + pd: + condition: process_healthy diff --git a/flake.nix b/flake.nix index b9a2628ed1..30eb6e8626 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,17 @@ vendorHash = "sha256-0iqI/Z8rqDyQ7JqSrsqA9kADqF6qZy8NxTDNjAYYHts="; }; + # Build grpcui from source, for Reflection v1 support. + # https://github.com/fullstorydev/grpcui/issues/322 + # To update the grpcui hash values, run: + # nix-prefetch-git --url https://github.com/fullstorydev/grpcui --rev 483f037ec98b89200353c696d990324318f8df98 + grpcUiRelease = { + version = "1.4.2-pre.1"; + sha256 = "sha256-3vjJNa1bXoMGZXPRyVqhxYZPX5FDp8Efy+w6gdx0pXE="; + vendorHash = "sha256-j7ZJeO9vhjOoR8aOOJymDM6D7mPAJQoD4O6AyAsErRY="; + rev = "483f037ec98b89200353c696d990324318f8df98"; + }; + # Set up for Rust builds, pinned to the Rust toolchain version in the Penumbra repository overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; @@ -91,6 +102,25 @@ license = licenses.asl20; }; }).overrideAttrs (_: { doCheck = false; }); # Disable tests to improve build times + + # grpcui + grpcui = (buildGoModule rec { + pname = "grpcui"; + version = grpcUiRelease.version; + subPackages = [ "cmd/grpcui" ]; + src = fetchFromGitHub { + owner = "fullstorydev"; + repo = "grpcui"; + rev = "${grpcUiRelease.rev}"; + hash = grpcUiRelease.sha256; + }; + vendorHash = grpcUiRelease.vendorHash; + meta = { + description = "gRPC UI, built from main, for Reflection v1 support"; + homepage = "https://github.com/fullstorydev/grpcui"; + license = licenses.mit; + }; + }).overrideAttrs (_: { doCheck = false; }); # Disable tests to improve build times in rec { packages = { inherit penumbra cometbft; }; apps = { @@ -117,6 +147,7 @@ cometbft grafana grpcurl + grpcui just mdbook mdbook-katex diff --git a/justfile b/justfile index 818449c776..e11ac43fdf 100644 --- a/justfile +++ b/justfile @@ -8,7 +8,8 @@ dev: ./deployments/scripts/check-nix-shell && \ ./deployments/scripts/run-local-devnet.sh \ --config ./deployments/compose/process-compose-postgres.yml \ - --config ./deployments/compose/process-compose-metrics.yml + --config ./deployments/compose/process-compose-metrics.yml \ + --config ./deployments/compose/process-compose-dev-tooling.yml # Formats the rust files in the project. fmt: