Skip to content

Commit cf014d7

Browse files
committed
Hmm …
1 parent 3e5575b commit cf014d7

3 files changed

Lines changed: 62 additions & 8 deletions

File tree

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ Based on <https://quantumleap.readthedocs.io/>.
55
Start the show:
66

77
``` shell name=start
8-
docker compose pull
9-
docker compose up --detach --wait
8+
task compose -- pull
9+
task compose -- up --detach --wait
1010

1111
open https://orion.quantumleap.local.itkdev.dk
1212
open https://grafana.quantumleap.local.itkdev.dk
1313
```
1414

1515
``` shell name=orion-subscription-create
1616
# https://quantumleap.readthedocs.io/en/latest/user/using/#orion-subscription
17-
docker compose exec --no-TTY orion curl --silent --show-error localhost:1026/v2/subscriptions --header 'content-type: application/json' --data @- <<EOF
17+
task compose -- exec --no-TTY orion curl --silent --show-error localhost:1026/v2/subscriptions --header 'content-type: application/json' --data @- <<EOF
1818
{
1919
"description": "Test subscription",
2020
"subject": {
@@ -37,12 +37,12 @@ EOF
3737
```
3838

3939
``` shell name=orion-subscriptions-get
40-
docker compose exec --no-TTY orion curl --silent --show-error localhost:1026/v2/subscriptions | jq
40+
task compose -- exec --no-TTY orion curl --silent --show-error localhost:1026/v2/subscriptions | jq
4141
```
4242

4343
``` shell name=orion-entity-create
4444
# https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2.html#entity-creation
45-
docker compose exec --no-TTY orion curl --silent --show-error localhost:1026/v2/entities --header 'content-type: application/json' --data @- <<EOF
45+
task compose -- exec --no-TTY orion curl --silent --show-error localhost:1026/v2/entities --header 'content-type: application/json' --data @- <<EOF
4646
{
4747
"id": "Room1",
4848
"type": "Room",
@@ -61,7 +61,7 @@ EOF
6161

6262
``` shell name=orion-entity-update substitutions="{«temperature.value»: 87, «pressure.value»: 42}"
6363
# https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2.html#update-entity
64-
docker compose exec --no-TTY orion curl --silent --show-error localhost:1026/v2/entities/Room1/attrs --header 'content-type: application/json' --data @- <<EOF
64+
task compose -- exec --no-TTY orion curl --silent --show-error localhost:1026/v2/entities/Room1/attrs --header 'content-type: application/json' --data @- <<EOF
6565
{
6666
"temperature": {
6767
"value": «temperature.value»,
@@ -78,8 +78,8 @@ EOF
7878
Talk to the timescale database:
7979

8080
``` shell name=timescale-query
81-
docker compose exec timescale psql quantumleap quantumleap --command '\dt'
82-
docker compose exec timescale psql quantumleap quantumleap --command 'SELECT * FROM etroom'
81+
task compose -- exec timescale psql quantumleap quantumleap --command '\dt'
82+
task compose -- exec timescale psql quantumleap quantumleap --command 'SELECT * FROM etroom'
8383
```
8484

8585
Generate some random data:

Taskfile.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# yaml-language-server: $schema=https://taskfile.dev/schema.json
2+
3+
version: '3'
4+
5+
# https://taskfile.dev/usage/#env-files
6+
dotenv:
7+
- .env.docker.local
8+
- .env.local
9+
- .env
10+
11+
vars:
12+
DOCKER_COMPOSE: '{{.TASK_DOCKER_COMPOSE | default "docker compose"}}'
13+
14+
tasks:
15+
grafana:reset-database:
16+
desc: Reset Grafana database
17+
prompt: Really?
18+
cmds:
19+
- git restore docker-compose.quantumleap.yml
20+
- |
21+
git apply <<'EOF'
22+
diff --git a/docker-compose.quantumleap.yml b/docker-compose.quantumleap.yml
23+
index 92329be..641c646 100644
24+
--- a/docker-compose.quantumleap.yml
25+
+++ b/docker-compose.quantumleap.yml
26+
@@ -122,4 +122,4 @@ services:
27+
- ./grafana/provisioning:/etc/grafana/provisioning
28+
- ./grafana/provisioning:/etc/grafana/provisioning
29+
# Cf. environment variable GF_PATHS_DATA
30+
- - ./.docker/data/grafana/grafana.db:/var/lib/grafana/grafana.db
31+
+ # - ./.docker/data/grafana/grafana.db:/var/lib/grafana/grafana.db
32+
EOF
33+
- mkdir -p .docker/data/grafana/
34+
- rm .docker/data/grafana/grafana.db || true
35+
- task: compose
36+
vars:
37+
TASK_ARGS: up --detach --wait grafana
38+
- task: compose
39+
vars:
40+
TASK_ARGS: cp grafana:/var/lib/grafana/grafana.db .docker/data/grafana/grafana.db
41+
- git restore docker-compose.quantumleap.yml
42+
43+
- task: compose
44+
vars:
45+
TASK_ARGS: up --detach
46+
47+
compose:
48+
cmds:
49+
- '{{.DOCKER_COMPOSE}} {{.TASK_ARGS}} {{.CLI_ARGS}}'

docker-compose.quantumleap.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,13 @@ services:
113113
# - GF_SERVER_PROTOCOL=https
114114
- GF_SERVER_DOMAIN=grafana.${COMPOSE_DOMAIN:?}
115115
# - GF_SERVER_HTTP_PORT=80
116+
# https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#data
117+
- GF_PATHS_DATA=/var/lib/grafana # The default value
116118
volumes:
117119
# https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/
118120
#- ./grafana/grafana.ini://etc/grafana/grafana.ini
119121
# https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/
120122
- ./grafana/provisioning:/etc/grafana/provisioning
123+
- ./grafana/provisioning:/etc/grafana/provisioning
124+
# Cf. environment variable GF_PATHS_DATA
125+
- ./.docker/data/grafana/grafana.db:/var/lib/grafana/grafana.db

0 commit comments

Comments
 (0)