Skip to main content
Use Docker Compose to run the Hivenet Router router with its full observability stack, then connect agents from separate inference hosts. The repository includes two Compose files: The router Compose file does not start an inference backend or agent. Run the agent Compose file separately on each host where an inference engine is available.

Stack overview

The router host runs: Each inference host runs: Prometheus scrapes the router’s metrics endpoint. Agents push their hardware, engine, latency, and routing signals to the router, so Prometheus does not need direct access to every agent host.

Network requirements

Prometheus, Loki, Tempo, and the router metrics endpoint remain inside the Compose network by default.
Restrict the router and agent ports to the systems that require them. Put Grafana behind a reverse proxy, VPN, or SSH tunnel before using it outside a trusted network.

Before you start

You need:
  • Docker 20.10 or later
  • Docker Compose 2.0 or later
  • Git, OpenSSL, curl, and jq
  • one router host
  • one or more inference hosts
  • network access between the router and agents
  • an inference backend running on each agent host
  • NVIDIA drivers and the NVIDIA Container Toolkit on GPU hosts
This guide assumes a vLLM backend is running on port 8888 of each agent host.

Configure the shared secret

The current Compose files contain a changeme placeholder for the router-agent JWT secret. Before starting the stack, change this line in both docker-compose.yml and docker-compose.agent.yml:
Replace it with:
The names use different capitalization deliberately:
  • HIVENET_ROUTER_JWT_SECRET is the host-side variable read by Docker Compose.
  • HIVENET_ROUTER_JWT_SECRET is the environment variable read inside the Hivenet Router container.
Create a .env file on the router host:
The repository ignores .env files by default. Do not commit the secret.
Every router and agent must use the same secret. Anyone with this value can authenticate an agent with the router.

Allow administrator access for this walkthrough

The router refuses to start with unauthenticated /admin/* endpoints unless the insecure override is explicitly enabled. For this local walkthrough, add the following environment value to the router service in docker-compose.yml:
This setting permits unauthenticated access to every administrator endpoint. Use it only in an isolated development environment. Configure administrator API-key authentication before exposing the router to shared or untrusted networks.

Start the router stack

1

Clone the repository

On the router host:
Make the JWT substitution described above in docker-compose.yml, then create the .env file.
2

Review the exposed ports

The router service publishes:
Grafana publishes:
Prometheus, Loki, Tempo, and port 2112 remain internal unless you change the Compose file.
3

Start the stack

Build the router and start all services:
Check their status:
The stack should include:
  • router
  • prometheus
  • grafana
  • tempo
  • loki
  • promtail
4

Check the router

Check the public liveness endpoint:
Expected response:
Check the operational health endpoint:
Before any agents register, the router should report zero agents and a degraded operational state.
5

Open Grafana

Open:
The default credentials are:
Change the password before exposing Grafana outside a trusted environment.You can also change the initial password before startup by editing:
in docker-compose.yml.

Connect an agent host

Repeat these steps on every machine that runs an inference backend.
1

Prepare the GPU host

Clone the repository:
Run the host setup script:
Replace 192.168.1.100 with the router’s reachable IP address.The script checks or installs:
  • Docker
  • Docker Compose
  • the NVIDIA Container Toolkit
  • GPU container access
  • required host packages
  • the host packages and container runtime required by the agent
If the script adds your account to the Docker group, sign out and back in before continuing.
2

Start the inference backend

The agent Compose file expects a backend on the host at:
For vLLM, one example is:
Wait for the model to load:
Then check the backend:
A ready vLLM server returns HTTP status 200.
3

Copy the shared secret

Copy the router’s .env file to the agent host through a secure channel:
Make the same JWT substitution in docker-compose.agent.yml:
4

Update and start the agent

The current agent connection path does not use --router-p2p, --p2p-listen-port, or --p2p-announce-addr.If docker-compose.agent.yml still contains these command entries, remove them before starting the agent:
Then set the router address and agent metadata:
Replace:
  • ROUTER_GRPC with the router’s gRPC authentication address
  • AGENT_REGION with the region label you want to expose
  • AGENT_CAPACITY with the concurrency the backend can support
  • MACHINE with a stable machine identifier
The agent authenticates through gRPC, receives the router’s libp2p connection details, and initiates the persistent transport connection. It needs outbound access to router ports 8902 and 8903; it does not expose an inbound Hivenet Router port.
5

Check the agent

Inspect the agent logs:
The logs should show that the agent authenticated and registered with the router.On the router host, confirm registration:
For a fuller view of routing, latency, hardware, and engine state:

Agent environment variables

The agent Compose file accepts: ROUTER_GRPC must be reachable from the agent host. After authentication, the router supplies the libp2p connection details the agent uses for its outbound transport connection.

Persistent data

The Compose files create named volumes: Running docker compose down stops and removes containers but retains these volumes. Running docker compose down -v also deletes the volumes and their data.

Configure routing policies

The router mounts the repository’s policies directory at:
Hivenet Router uses least-loaded routing without a policy file by default. To use one global policy, add these values to the router’s command list in docker-compose.yml:
To load policies by model, use:
Per-model policy loading is the better choice when different models need different filters, gates, or fallback behavior. See Policy YAML reference for the complete schema.

Configure API authentication

Client authentication is disabled when no auth configuration is provided.

Static API keys

Copy the example configuration:
Add the required key hashes and access rules. Then mount the file in docker-compose.yml:
Add the router arguments:

Dynamic API keys

For runtime-managed keys, add these container environment variables to the router service:
Add the corresponding host-side value to .env:
Admin authentication is mandatory in dynamic mode. The router refuses to start without an admin key because the admin endpoints manage the API-key registry itself. See API keys for the complete setup.

Configure persistent quota counters

Quota counters use in-memory storage by default and reset when the router restarts. To persist daily token counters in BadgerDB, add:
to the router environment. The existing badger_data volume preserves those counters across container restarts.

Configure debug logging

Set one global log level:
Or configure specific subsystems:
Apply the setting to the router, agent, or both.

Access the services

To inspect Prometheus without exposing it publicly, use an SSH tunnel:
Prometheus is not published by default, so first add a loopback-only port mapping:
Then open:

Useful Prometheus queries

Active agents:
Request routing rate:
Failed routing rate:
Smoothed round-trip time by model:

Grafana dashboards

The repository provisions dashboards for:
  • router and agent health
  • request and routing counters
  • smoothed round-trip time
  • hardware and engine metrics
  • policy routing behavior
  • tenant usage
  • audit logs
Router traces are sent to Tempo through OpenTelemetry. Explore them through Grafana’s Tempo data source. Audit log records are written to the shared audit_logs volume. Promtail reads those files and sends them to Loki.

Back up persistent data

Stop the stack before taking filesystem-level snapshots:
Create a backup directory:
The default volume names assume the Compose project is named hivenet-router. Confirm the actual names first:
Back up the router database:
Back up Prometheus:
Back up Grafana:
Restart the stack:

Restore the router database

Stop the stack:
Clear the existing contents and restore the archive:
Restart:

Troubleshooting

An agent does not appear

Check the agent logs:
Test the agent’s connection to the router:
Check the router logs:
Common causes include:
  • a different JWT secret on the router and agent
  • an incorrect or unreachable ROUTER_GRPC address
  • the router advertising a libp2p address the agent cannot reach
  • a missing or incorrect router --p2p-announce-addr behind NAT or port translation
  • an unhealthy inference backend

Prometheus cannot scrape the router

Inspect Prometheus targets:
Check the router endpoint from the Prometheus container:

Grafana has no metrics

Confirm that Prometheus contains Hivenet Router data:
Check the service logs:

Grafana has no audit logs

Check Loki and Promtail:
Confirm that the router writes audit records to the shared volume:

Agent metrics are missing

Agents do not expose a separate Prometheus endpoint for this deployment. They push metrics to the router. Inspect the routing table:
If the agent is missing or unhealthy, check its backend, network connection, logs, and JWT secret.

Next steps

Bare metal

Run the router and agents directly without Docker.

vLLM agent

Configure a vLLM backend, model discovery, metrics, and capacity.

Grafana dashboards

Understand the provisioned dashboards and data sources.