Skip to content

Optional native gRPC inventory listener

The backend serves four admin-only inventory RPCs. The listener always runs inside the backend container; the override publishes it from the lightweight stack on host loopback, using the same pinned backend image:

For a step-by-step classroom exercise, see the gRPC training runbook.

docker compose -f lightweight-docker-compose.yml -f docker-compose.grpc.yml config --quiet
docker compose -f lightweight-docker-compose.yml -f docker-compose.grpc.yml up -d

To turn the lightweight listener off again without tearing down the stack, run docker compose -f lightweight-docker-compose.yml up -d --force-recreate backend. Use docker-compose.yml instead for the full profile. The override defaults to the same pinned backend image and preserves the base active profiles, adding graphql,grpc and a loopback port. GRPC_BACKEND_IMAGE can select a candidate image in a disposable compatibility run. No other service or image pin changes.

The native endpoint is 127.0.0.1:9091. Change GRPC_HOST_PORT if that host port is occupied. Inside the backend container, gRPC listens on 9091. The host mapping is loopback-only, including when this override is merged with the server file. There is no public gRPC route through nginx.

Server reflection is disabled, so use the checked-in .proto with grpcurl or Postman; health requires an admin JWT. Without this override the listener runs only inside the container and is not reachable from the host. The server profile publishes it as described below. GraphQL and GraphiQL are always available over the HTTP gateway.

For examples, status codes, presence semantics, deadlines, and idempotent retry rules, see backend gRPC documentation (written for the original Java backend, archived; backend-rs keeps the behaviour).

Server deployment and SSH access

The server profile enables native gRPC explicitly for both backend instances. The stable inventory listener is published on server loopback 127.0.0.1:9091; the disposable aitesters listener uses 127.0.0.1:9092. Neither listener is a public nginx endpoint. Reflection remains disabled and every inventory RPC requires the corresponding site's admin JWT.

Create a tunnel using the existing Vault-managed SSH settings:

eval "$(cd ansible && ./resolve-ssh-vars.sh)"
ssh -o StrictHostKeyChecking=accept-new -N \
  -L 14991:127.0.0.1:9091 -L 14992:127.0.0.1:9092 \
  -p "$SSH_PORT" -i "$SSH_KEY_PATH" "$SSH_USER@$SSH_HOST"

Point grpcurl at 127.0.0.1:14991 for stable data or 127.0.0.1:14992 for sandbox data. The tunnel supplies encryption for the plaintext native listener. Use the matching site's JWT and, for traffic capture, its frontend traffic session ID. See the protocol lab. The standalone full/lightweight profiles still require the opt-in gRPC override.