Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions infra/workstation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Workstation: collector and visz

The demo's collector and visz run on the laptop you present from, not in the K3s cluster: the cluster nodes are small and far away, and the collector does the analysis while visz renders it. The sidecars in the cluster report to the laptop over Tailscale.

```
K3s cluster (peers only) this laptop (Docker)
foodbolt pods + spctrld ──Tailscale──▶ collector :9400 (ghcr.io/cap-theorem/spectral-collector)
visz :9500 ──▶ browser
```

## Start

From this directory, with Docker running, and `cap-theorem/visz` checked out next to this repository (or `VISZ_DIR` pointing at it):

```bash
docker compose up -d --build
```

Then open http://localhost:9500. visz is built to read the collector at http://localhost:9400. If your browser remembers an older collector URL, open http://localhost:9500/?collector=http://localhost:9400 once.

`COLLECTOR_TAG` picks the collector image (default `sha-297689b`). Keep it in step with the `SPCTRLD_TAG` the peers run. The collector drops a node one minute after its last report (`--stale-after=1m`).

Peers started with `scripts/demo` report to `http://<this machine's Tailscale IP>:9400` by default. Check that the cluster can reach it:

```bash
curl -s http://$(tailscale ip -4):9400/v1/summary
```

## Stop

```bash
docker compose down
```

The collector keeps the graph in memory only, so restarting it starts from an empty graph that fills again within one report interval (about 30 s). While this laptop sleeps or is off the tailnet, the sidecars' reports fail and the graph goes stale.
25 changes: 25 additions & 0 deletions infra/workstation/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: spectral-workstation

services:
collector:
image: ghcr.io/cap-theorem/spectral-collector:${COLLECTOR_TAG:-sha-297689b}
pull_policy: always
command:
- --listen-addr=:9400
- --stale-after=1m
- --log-format=json
ports:
- "9400:9400"
restart: unless-stopped

visz:
build:
context: ${VISZ_DIR:-../../../visz}
args:
VITE_COLLECTOR_URL: http://localhost:9400
image: visz:local
ports:
- "9500:80"
depends_on:
- collector
restart: unless-stopped
Loading