Skip to content

Commit 1cdc19f

Browse files
Merge pull request #51 from NeedleInAJayStack/feat/provisioning
Adds provisioning to improve development and testing
2 parents 7c499a7 + f00f1bd commit 1cdc19f

8 files changed

Lines changed: 89 additions & 32 deletions

File tree

DEVELOPMENT_GUIDE.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ yarn dev
2020
1. Build the back-end, inject it into a docker image, and run it alongside a Haxall server:
2121

2222
```bash
23-
mage -v && docker compose -f docker-compose_dev.yaml up
23+
mage -v && docker compose up
2424
```
2525

2626
## Usage
2727

28-
Create a new data source and select "Haystack". If no Docker configuration has been edited, the Haystack API is available at
29-
`http://haxall:8080/api/`, with the username `su` and password `su`. Click "Save and Test" and make sure that it is
30-
working.
28+
An example datasource and dashboard are created by the provisioning system.
3129

32-
Create a new dashboard and panel, and use this axon query to test the connection:
30+
If you'd like to create a new dashboard and panel, you use this axon query to test the connection:
3331

3432
```
3533
[{ts: now()-1hr, v0: 0}, {ts: now(), v0: 10}].toGrid

docker-compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@ services:
77
extends:
88
file: .config/docker-compose-base.yaml
99
service: grafana
10+
haxall:
11+
image: "needleinajaystack/haxall:latest"
12+
environment:
13+
- SU_USER=su
14+
- SU_PASS=su
15+
ports:
16+
- 8080:8080/tcp
17+
volumes:
18+
- ~/haxall/proj:/opt/haxall/proj

docker-compose_dev.yaml

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

provisioning/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
For more information see [Provision dashboards and data sources](https://grafana.com/tutorials/provision-dashboards-and-data-sources/)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: 1
2+
3+
providers:
4+
- name: 'provisioning'
5+
disableDeletion: true
6+
updateIntervalSeconds: 10
7+
allowUiUpdates: false
8+
options:
9+
path: /etc/grafana/provisioning/dashboards
10+
foldersFromFilesStructure: true
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"uid": "haystack-example",
3+
"title": "Haystack Example",
4+
"schemaVersion": 39,
5+
"version": 1,
6+
"editable": true,
7+
"tags": [],
8+
"time": { "from": "now-6h", "to": "now" },
9+
"timepicker": {},
10+
"refresh": "",
11+
"panels": [
12+
{
13+
"id": 1,
14+
"type": "timeseries",
15+
"title": "Time Series",
16+
"gridPos": { "x": 0, "y": 0, "w": 12, "h": 8 },
17+
"datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" },
18+
"targets": [
19+
{
20+
"refId": "A",
21+
"datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" },
22+
"type": "eval",
23+
"eval": "[{ts: now()-1hr, v0: 0}, {ts: now(), v0: 10}].toGrid"
24+
}
25+
]
26+
},
27+
{
28+
"id": 2,
29+
"type": "table",
30+
"title": "Table",
31+
"gridPos": { "x": 12, "y": 0, "w": 12, "h": 8 },
32+
"datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" },
33+
"targets": [
34+
{
35+
"refId": "A",
36+
"datasource": { "type": "needleinajaystack-haystack-datasource", "uid": "Haystack" },
37+
"type": "eval",
38+
"eval": "[{name: \"a\", value: 75, temp}, {name: \"b\", value: 5, pressure}].toGrid"
39+
}
40+
]
41+
}
42+
],
43+
"__requires": [
44+
{
45+
"type": "datasource",
46+
"id": "needleinajaystack-haystack-datasource",
47+
"name": "Haystack",
48+
"version": "1.0.0"
49+
}
50+
]
51+
}

provisioning/datasources/.gitkeep

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: 'Haystack'
5+
type: 'needleinajaystack-haystack-datasource'
6+
access: proxy
7+
isDefault: true
8+
orgId: 1
9+
version: 1
10+
editable: true
11+
jsonData:
12+
url: 'http://haxall:8080/api/'
13+
username: 'su'
14+
secureJsonData:
15+
password: 'su'

0 commit comments

Comments
 (0)