Skip to content

Examples

Runnable starting points for the hub and its clients. Full reference: the server pages.

Run the hub

docker run --rm -p 7000:7000 -p 7001:7001 \
  -e SNODRA_SERVER_OTLP_ENDPOINT= \
  snodra/snodra-server:latest

Or with Compose:

services:
  snodra-server:
    image: snodra/snodra-server:latest
    ports: ["7000:7000", "7001:7001"]
    environment:
      SNODRA_SERVER_OTLP_ENDPOINT: ""
    healthcheck:
      test: ["CMD", "/app/snodra-server", "--health-check"]

Dashboard: http://localhost:7001/ui/ ยท version: curl -s localhost:7001/api/v1/version

Register a service

Any gRPC client opens Hub.Connect, sends Register with the types it handles and keeps the stream open. The Kotlin starter and the Rust crate do it for you.

Register{ service_name: "orders", instance_id: "orders-1",
          commands: ["orders.PlaceOrder"], queries: [] }

Send a request

Request{ request_id: "r-1", type: "orders.PlaceOrder",
         payload: {"id":"o-1","item":"banner"}, timeout_ms: 5000 }

The hub routes it to a live orders instance and relays Reply or Error.

Authentication

openssl rand -hex 32                       # the service's token
echo '<the token>' | docker run --rm -i --entrypoint /app/snodra-server \
  snodra/snodra-server:latest acl hash -  # its SHA-256 for the ACL

docker run --rm -p 7000:7000 -p 7001:7001 \
  -e SNODRA_SERVER_AUTH_MODE=permissive \
  -e SNODRA_SERVER_ACL_FILE=/etc/snodra/snodra.acl.toml \
  -v "$PWD/snodra.acl.toml:/etc/snodra/snodra.acl.toml:ro" \
  snodra/snodra-server:latest

Then follow the authentication pages.