Examples
Runnable starting points for the hub and its clients. Full reference: the server pages.
Run the hub
Section titled “Run the hub”docker run --rm -p 7000:7000 -p 7001:7001 \ snodra/snodra-server:latestOr with Compose:
services: snodra-server: image: snodra/snodra-server:latest ports: ["7000:7000", "7001:7001"] environment: healthcheck: test: ["CMD", "/app/snodra-server", "--health-check"]Dashboard: http://localhost:7001/ui/ · version: curl -s localhost:7001/api/v1/version
Register a service
Section titled “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
Section titled “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
Section titled “Authentication”openssl rand -hex 32 # the service's tokenecho '<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:latestThen follow the authentication pages.