Skip to content

Commit 925c830

Browse files
authored
doc: add dashboard.md in overview & update README (#432)
Signed-off-by: JaredforReal <w13431838023@gmail.com>
1 parent ce99067 commit 925c830

File tree

13 files changed

+256
-135
lines changed

13 files changed

+256
-135
lines changed

dashboard/README.md

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,27 @@ Pages:
3939

4040
- **Landing** (`/`): Intro landing with animated terminal demo and quick links
4141
- **Monitoring** (`/monitoring`): Grafana dashboard embedding with custom path input
42-
- **Config** (`/config`): Real-time configuration viewer with non-persistent edit demo (see note)
42+
- **Config** (`/config`): Real-time configuration viewer with editable panels and save support
43+
- **Topology** (`/topology`): Visual topology of request flow and model selection using React Flow
4344
- **Playground** (`/playground`): Open WebUI interface for testing
4445

4546
Features:
4647

47-
- 🌓 Dark/Light theme toggle with localStorage persistence
48-
- 📱 Responsive design
48+
- 🌓 Dark/Light theme toggle with localStorage persistence (default: light)
49+
- � Collapsible sidebar with quick section navigation (Models, Prompt Guard, Similarity Cache, Intelligent Routing, Topology, Tools Selection, Observability, Classification API)
50+
- �📱 Responsive design
4951
- ⚡ Fast navigation with React Router
5052
- 🎨 Modern UI inspired by vLLM website design
53+
- 🗺️ Topology visualization powered by React Flow
5154

52-
Config edit demo (frontend only):
55+
Config editing:
5356

54-
- The Config page includes edit/add modals to showcase how configuration could be managed.
55-
- Current backend is read-only for config: it exposes `GET /api/router/config/all` only.
56-
- Demo save targets `POST /api/router/config/update` (not implemented by default). You can wire this endpoint in the backend to persist changes, or keep the edits as a UI mock.
57-
- Tools DB panel attempts to load `/api/tools-db` for `tools_db.json`. Add a backend route or static file handler to serve this if you want it live.
57+
- The Config page includes edit/add modals for multiple sections (Models, Endpoints, Prompt Guard, Similarity Cache, Categories, Reasoning Families, Tools, Observability, Batch Classification API).
58+
- Backend supports read/write operations:
59+
- `GET /api/router/config/all` returns the current config (YAML parsed and served as JSON).
60+
- `POST /api/router/config/update` updates the config file on disk (writes YAML). Requires the process to have write permission to the specified config path.
61+
- Tools DB panel loads `/api/tools-db`, which serves `tools_db.json` from the same directory as your config file.
62+
- Note for containers/Kubernetes: if the config is mounted from a read-only ConfigMap, updates won’t persist. Mount a writable volume or manage config externally if you need persistence.
5863

5964
### Backend (Go HTTP Server)
6065

@@ -65,12 +70,19 @@ Config edit demo (frontend only):
6570
- `GET /embedded/openwebui/*` → Open WebUI (optional)
6671
- `GET /api/router/*` → Router Classification API (`:8080`)
6772
- `GET /metrics/router` → Router `/metrics` (optional aggregation later)
68-
- `GET /api/router/config/all` → Returns your `config.yaml` as JSON (read-only)
73+
- `GET /api/router/config/all` → Returns your `config.yaml` as JSON (parsed from YAML)
74+
- `POST /api/router/config/update` → Updates your `config.yaml` (writes YAML)
75+
- `GET /api/tools-db` → Returns `tools_db.json` next to your config
6976
- `GET /healthz` → Health check endpoint
7077
- Normalizes headers for iframe embedding: strips/overrides `X-Frame-Options` and `Content-Security-Policy` frame-ancestors as needed
7178
- SPA routing support: serves `index.html` for all non-asset routes
7279
- Central point for JWT/OIDC in the future (forward or exchange tokens to upstreams)
7380

81+
Smart API routing:
82+
83+
- Requests to `/api/router/*` go to the Router API with Authorization forwarded.
84+
- Other `/api/*` requests (e.g., Grafana’s API) are proxied to Grafana when configured.
85+
7486
## Directory Layout
7587

7688
```
@@ -98,10 +110,8 @@ dashboard/
98110
│ ├── main.go # Proxy routes & static file server
99111
│ ├── go.mod # Go module (minimal dependencies)
100112
│ └── Dockerfile # Multi-stage build (Node + Go + Alpine)
101-
├── deploy/
102-
│ └── kubernetes/ # K8s manifests (Deployment/Service/ConfigMap)
103113
├── README.md # This file
104-
└── (no RISKS.md) # Security considerations are documented inline for now
114+
└── (K8s/Compose manifests live under the repository-level `deploy/` folder)
105115
```
106116

107117
## Environment-agnostic configuration
@@ -116,7 +126,10 @@ Required env vars (with sensible defaults per environment):
116126
- `TARGET_ROUTER_API_URL` (router `:8080`)
117127
- `TARGET_ROUTER_METRICS_URL` (router `:9190/metrics`)
118128
- `TARGET_OPENWEBUI_URL` (optional; enable playground tab only if present)
119-
Note: The backend already adjusts frame-busting headers (X-Frame-Options/CSP) to allow embedding from the dashboard origin; no extra env flag is required.
129+
Optional:
130+
- `ROUTER_CONFIG_PATH` (default: `../../config/config.yaml`) — path to the router config file used by the config APIs and Tools DB.
131+
- `DASHBOARD_STATIC_DIR` — override static assets directory (defaults to `../frontend`).
132+
Note: The backend already adjusts frame-busting headers (X-Frame-Options/CSP) to allow embedding from the dashboard origin; no extra env flag is required.
120133

121134
Recommended upstream settings for embedding:
122135

@@ -128,11 +141,12 @@ Recommended upstream settings for embedding:
128141
- Dashboard Home (Landing): `http://<host>:8700/`
129142
- Monitoring tab: iframe `src="/embedded/grafana/d/<dashboard-uid>?kiosk&theme=light"`
130143
- Config tab: frontend fetch `GET /api/router/config/all` (demo edit modals; see note above)
144+
- Topology tab: client fetch of `GET /api/router/config/all` to render the flow graph
131145
- Playground tab: iframe `src="/embedded/openwebui/"` (rendered only if `TARGET_OPENWEBUI_URL` is set)
132146

133147
## Deployment matrix
134148

135-
1) Local dev (router and observability on host)
149+
1. Local dev (router and observability on host)
136150

137151
- Use `tools/observability/docker-compose.obs.yml` to start Prometheus (9090) and Grafana (3000) on host network
138152
- Start dashboard backend locally (port 8700)
@@ -143,7 +157,7 @@ Recommended upstream settings for embedding:
143157
- `TARGET_ROUTER_METRICS_URL=http://localhost:9190/metrics`
144158
- `TARGET_OPENWEBUI_URL=http://localhost:3001` (if running)
145159

146-
2) Docker Compose (all-in-one)
160+
2. Docker Compose (all-in-one)
147161

148162
- Reuse services defined in `deploy/docker-compose/docker-compose.yml` (Dashboard included by default)
149163
- Env examples (inside compose network):
@@ -153,10 +167,10 @@ Recommended upstream settings for embedding:
153167
- `TARGET_ROUTER_METRICS_URL=http://semantic-router:9190/metrics`
154168
- `TARGET_OPENWEBUI_URL=http://openwebui:8080` (if included)
155169

156-
3) Kubernetes
170+
3. Kubernetes
157171

158-
- Install/confirm Prometheus and Grafana via existing manifests in `deploy/kubernetes/observability`
159-
- Deploy dashboard in `dashboard/deploy/kubernetes/`
172+
- Install/confirm Prometheus and Grafana via existing manifests in `deploy/kubernetes/observability` (repository root)
173+
- Deploy the dashboard via manifests under the repository-level `deploy/kubernetes/` (or create one similar to the Compose setup)
160174
- Configure the dashboard Deployment with in-cluster URLs:
161175
- `TARGET_GRAFANA_URL=http://grafana.<ns>.svc.cluster.local:3000`
162176
- `TARGET_PROMETHEUS_URL=http://prometheus.<ns>.svc.cluster.local:9090`
@@ -171,10 +185,15 @@ Recommended upstream settings for embedding:
171185
- Frame embedding: backend strips/overrides `X-Frame-Options` and `Content-Security-Policy` headers from upstreams to permit `frame-ancestors 'self'` only
172186
- Future: OIDC login on dashboard, session cookie, and per-route RBAC; signed proxy sessions to Grafana/Open WebUI
173187

188+
Write access warning for config updates:
189+
190+
- The `POST /api/router/config/update` endpoint writes to the mounted config path. In Docker/K8s this may be read-only if sourced from a ConfigMap. Use a writable volume, bind-mount, or external configuration service if you need runtime persistence.
191+
174192
## Extensibility
175193

176194
- New panels: add tabs/components to `frontend/`
177195
- New integrations: add target env vars and a new `/embedded/<service>` route in backend proxy
196+
- Topology: customize nodes/edges in `TopologyPage.tsx` (React Flow)
178197
- Metrics aggregation: add `/api/metrics` in backend to produce derived KPIs from Prometheus
179198

180199
## Implementation notes
@@ -213,7 +232,7 @@ docker compose -f tools/observability/docker-compose.obs.yml up -d
213232
cd dashboard/frontend
214233
npm install
215234
npm run dev
216-
# Vite runs at http://localhost:3001 and proxies /api and /embedded to http://localhost:8700
235+
# Vite runs at http://localhost:3001 and proxies /api, /embedded and /healthz to http://localhost:8700
217236

218237
# 3) Start the Dashboard backend in another terminal
219238
cd dashboard/backend
@@ -285,19 +304,19 @@ curl http://localhost:8700/healthz
285304

286305
### Kubernetes deployment
287306

288-
The manifest at `dashboard/deploy/kubernetes/deployment.yaml` includes:
307+
Example deployment notes (adapt these to your cluster setup):
289308

290-
- Deployment with args `-port=8700 -static=/app/frontend -config=/app/config/config.yaml`
309+
- Deployment using args `-port=8700 -static=/app/frontend -config=/app/config/config.yaml`
291310
- Service (ClusterIP) exposing port 80 → container port 8700
292-
- ConfigMap `semantic-router-dashboard-config` for upstream targets (`TARGET_*` env)
293-
- ConfigMap `semantic-router-config` to provide a minimal `config.yaml` (replace with your real one)
311+
- ConfigMap/Secret for upstream targets (`TARGET_*` env) and your router config file
294312

295313
Quick start:
296314

297315
```bash
298316
# Set your namespace and apply
299317
kubectl create ns vllm-semantic-router-system --dry-run=client -o yaml | kubectl apply -f -
300-
kubectl -n vllm-semantic-router-system apply -f dashboard/deploy/kubernetes/deployment.yaml
318+
# Apply your manifests under deploy/kubernetes/
319+
kubectl -n vllm-semantic-router-system apply -f deploy/kubernetes/
301320
302321
# Port-forward for local testing
303322
kubectl -n vllm-semantic-router-system port-forward svc/semantic-router-dashboard 8700:80
@@ -306,8 +325,8 @@ kubectl -n vllm-semantic-router-system port-forward svc/semantic-router-dashboar
306325

307326
Notes:
308327

309-
- Edit `semantic-router-dashboard-config` in the YAML to match your in-cluster service DNS names and namespace.
310-
- Replace `semantic-router-config` content with your actual `config.yaml` or mount a Secret/ConfigMap you already manage.
328+
- Configure environment variables to match your in-cluster service DNS names and namespace.
329+
- Mount your actual `config.yaml` via ConfigMap/Secret or a writable volume if you need runtime changes.
311330
- To expose externally, add an Ingress or Service of type LoadBalancer according to your cluster.
312331

313332
Optional Ingress example (Nginx Ingress):

dashboard/deploy/kubernetes/.gitkeep

Whitespace-only changes.

dashboard/deploy/kubernetes/deployment.yaml

Lines changed: 0 additions & 100 deletions
This file was deleted.

dashboard/deploy/local/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)