From 1bdd49d6493546730838370d20451290e92a45e7 Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Wed, 3 Jun 2026 23:41:39 -0600 Subject: [PATCH 1/3] feat: Adds datasource provisioning --- provisioning/README.md | 1 + provisioning/datasources/.gitkeep | 0 provisioning/datasources/datasources.yml | 15 +++++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 provisioning/README.md create mode 100644 provisioning/datasources/.gitkeep create mode 100644 provisioning/datasources/datasources.yml diff --git a/provisioning/README.md b/provisioning/README.md new file mode 100644 index 0000000..90a1ccf --- /dev/null +++ b/provisioning/README.md @@ -0,0 +1 @@ +For more information see [Provision dashboards and data sources](https://grafana.com/tutorials/provision-dashboards-and-data-sources/) \ No newline at end of file diff --git a/provisioning/datasources/.gitkeep b/provisioning/datasources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/provisioning/datasources/datasources.yml b/provisioning/datasources/datasources.yml new file mode 100644 index 0000000..67aa0d8 --- /dev/null +++ b/provisioning/datasources/datasources.yml @@ -0,0 +1,15 @@ +apiVersion: 1 + +datasources: + - name: 'Haystack' + type: 'needleinajaystack-haystack-datasource' + access: proxy + isDefault: true + orgId: 1 + version: 1 + editable: true + jsonData: + url: 'http://haxall:8080/api/' + username: 'su' + secureJsonData: + password: 'su' From f83e11511c19a364b70d0c17f27976dedefb006e Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Thu, 4 Jun 2026 00:22:06 -0600 Subject: [PATCH 2/3] feat: Adds provisioned dashboard --- provisioning/dashboards/dashboards.yaml | 10 +++++ provisioning/dashboards/example.json | 51 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 provisioning/dashboards/dashboards.yaml create mode 100644 provisioning/dashboards/example.json diff --git a/provisioning/dashboards/dashboards.yaml b/provisioning/dashboards/dashboards.yaml new file mode 100644 index 0000000..283af0b --- /dev/null +++ b/provisioning/dashboards/dashboards.yaml @@ -0,0 +1,10 @@ +apiVersion: 1 + +providers: + - name: 'provisioning' + disableDeletion: true + updateIntervalSeconds: 10 + allowUiUpdates: false + options: + path: /etc/grafana/provisioning/dashboards + foldersFromFilesStructure: true diff --git a/provisioning/dashboards/example.json b/provisioning/dashboards/example.json new file mode 100644 index 0000000..cb5b1e3 --- /dev/null +++ b/provisioning/dashboards/example.json @@ -0,0 +1,51 @@ +{ + "uid": "haystack-example", + "title": "Haystack Example", + "schemaVersion": 39, + "version": 1, + "editable": true, + "tags": [], + "time": { "from": "now-6h", "to": "now" }, + "timepicker": {}, + "refresh": "", + "panels": [ + { + "id": 1, + "type": "timeseries", + "title": "Time Series", + "gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 }, + "datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" }, + "type": "eval", + "eval": "[{ts: now()-1hr, v0: 0}, {ts: now(), v0: 10}].toGrid" + } + ] + }, + { + "id": 2, + "type": "table", + "title": "Table", + "gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 }, + "datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" }, + "targets": [ + { + "refId": "A", + "datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" }, + "type": "eval", + "eval": "[{name: \"a\", value: 75, temp}, {name: \"b\", value: 5, pressure}].toGrid" + } + ] + } + ], + "__requires": [ + { + "type": "datasource", + "id": "needleinajaystack-haystack-datasource", + "name": "Haystack", + "version": "1.0.0" + } + ] +} From f00f1bd243edca8cbf54166715d442090827a01d Mon Sep 17 00:00:00 2001 From: Jay Herron Date: Thu, 4 Jun 2026 00:33:25 -0600 Subject: [PATCH 3/3] refactor: Unifies docker compose files --- DEVELOPMENT_GUIDE.md | 8 +++----- docker-compose.yaml | 9 +++++++++ docker-compose_dev.yaml | 27 --------------------------- 3 files changed, 12 insertions(+), 32 deletions(-) delete mode 100644 docker-compose_dev.yaml diff --git a/DEVELOPMENT_GUIDE.md b/DEVELOPMENT_GUIDE.md index 916599a..6e0b0e2 100644 --- a/DEVELOPMENT_GUIDE.md +++ b/DEVELOPMENT_GUIDE.md @@ -20,16 +20,14 @@ yarn dev 1. Build the back-end, inject it into a docker image, and run it alongside a Haxall server: ```bash -mage -v && docker compose -f docker-compose_dev.yaml up +mage -v && docker compose up ``` ## Usage -Create a new data source and select "Haystack". If no Docker configuration has been edited, the Haystack API is available at -`http://haxall:8080/api/`, with the username `su` and password `su`. Click "Save and Test" and make sure that it is -working. +An example datasource and dashboard are created by the provisioning system. -Create a new dashboard and panel, and use this axon query to test the connection: +If you'd like to create a new dashboard and panel, you use this axon query to test the connection: ``` [{ts: now()-1hr, v0: 0}, {ts: now(), v0: 10}].toGrid diff --git a/docker-compose.yaml b/docker-compose.yaml index 01eeebb..b31f5d9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,3 +7,12 @@ services: extends: file: .config/docker-compose-base.yaml service: grafana + haxall: + image: "needleinajaystack/haxall:latest" + environment: + - SU_USER=su + - SU_PASS=su + ports: + - 8080:8080/tcp + volumes: + - ~/haxall/proj:/opt/haxall/proj diff --git a/docker-compose_dev.yaml b/docker-compose_dev.yaml deleted file mode 100644 index 42861ca..0000000 --- a/docker-compose_dev.yaml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3.0' - -services: - grafana: - container_name: 'needleinajaystack-haystack-datasource' - build: - context: ./.config - args: - grafana_version: ${GRAFANA_VERSION:-latest} - ports: - - 3000:3000/tcp - volumes: - - ./dist:/var/lib/grafana/plugins/needleinajaystack-haystack-datasource - - ./provisioning:/etc/grafana/provisioning - - grafana_data:/var/lib/grafana - haxall: - image: "needleinajaystack/haxall:latest" - environment: - - SU_USER=su - - SU_PASS=su - ports: - - 8080:8080/tcp - volumes: - - ~/haxall/proj:/opt/haxall/proj - -volumes: - grafana_data: