mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-05-24 09:29:15 +00:00
## Summary
Add a `provision-dashboards` task that reads `.json` files from a directory and upserts dashboards into MongoDB, following the existing task system pattern (same as `check-alerts`).
Provisioned dashboards are flagged with `provisioned: true` so they never overwrite user-created dashboards with the same name. Files are validated against `DashboardWithoutIdSchema`. Removing a file does not delete the dashboard (safe by default, same as Grafana). The task is deployment-agnostic: it reads from a directory, regardless of how files get there.
When `DASHBOARD_PROVISIONER_DIR` is set, `entry.prod.sh` automatically starts the task as an additional process alongside the API, App, and check-alerts.
**Note:** Users can currently edit provisioned dashboards through the UI, but changes will be overwritten on the next sync cycle. Grafana handles this by blocking saves on provisioned dashboards. Adding a similar guard would be a good follow-up to improve UX.
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `DASHBOARD_PROVISIONER_DIR` | Yes | | Directory to read `.json` files from |
| `DASHBOARD_PROVISIONER_TEAM_ID` | No* | | Scope to a specific team ID |
| `DASHBOARD_PROVISIONER_ALL_TEAMS` | No* | `false` | Set to `true` to provision to all teams |
\*One of `DASHBOARD_PROVISIONER_TEAM_ID` or `DASHBOARD_PROVISIONER_ALL_TEAMS=true` is required.
### How to test locally or on Vercel
1. Create a directory with a dashboard JSON file:
```bash
mkdir /tmp/dashboards
echo '{"name":"Test Dashboard","tiles":[],"tags":[]}' > /tmp/dashboards/test.json
2. Run the task:
DASHBOARD_PROVISIONER_DIR=/tmp/dashboards DASHBOARD_PROVISIONER_ALL_TEAMS=true \
./packages/api/bin/hyperdx task provision-dashboards
3. Verify the dashboard appears in the UI
4. Modify the JSON file, run again, verify it updates
5. Delete the JSON file, run again, verify the dashboard persists
References
- Related PRs: https://github.com/ClickHouse/ClickStack-helm-charts/pull/190
|
||
|---|---|---|
| .. | ||
| clickhouse/local | ||
| hostmetrics | ||
| hyperdx | ||
| nginx | ||
| otel-collector | ||