Skip to content

Commit 5f103f1

Browse files
Merge pull request #117 from XavierGeerinck/master
Add parking garage example
2 parents d731ee1 + 23e1f0e commit 5f103f1

File tree

18 files changed

+9745
-7
lines changed

18 files changed

+9745
-7
lines changed

documentation/development.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ Tests are written per protocol layer: http or grpc. This is done because Dapr re
3838
docker run -d --rm --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx
3939

4040
# Start gRPC tests
41-
npm run test:dapr:grpc
41+
npm run test:e2e:grpc:main
4242

4343
# Start HTTP tests
44-
npm run test:dapr:http
44+
npm run test:e2e:http:main
45+
npm run test:e2e:http:actors
4546
```
47+
48+
## Publishing
49+
50+
./scripts/publish.sh
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Examples - Hello World
2+
3+
## TODO
4+
5+
```bash
6+
# Run InfluxDB
7+
# Note: it auto removes after shutdown
8+
# Note: non-persistent volume, add "-v influxdb2:/var/lib/influxdb2" to make it persistent
9+
docker run --rm -it -d \
10+
-e DOCKER_INFLUXDB_INIT_MODE=setup \
11+
-e DOCKER_INFLUXDB_INIT_USERNAME=admin \
12+
-e DOCKER_INFLUXDB_INIT_PASSWORD=MyAdmin@123! \
13+
-e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-token \
14+
-e DOCKER_INFLUXDB_INIT_ORG=my-parking-garage \
15+
-e DOCKER_INFLUXDB_INIT_BUCKET=my-sensors \
16+
--net=host \
17+
--name influxdb \
18+
influxdb:2.0
19+
20+
# Run Telegraf
21+
docker run --rm -it -d \
22+
--net=host \
23+
--name=telegraf \
24+
telegraf
25+
26+
# Run Grafana
27+
# Note: non-persistent volume, add "-v influxdb2:/var/lib/influxdb2" to make it persistent
28+
docker run --rm -it -d \
29+
--name=grafana \
30+
--net=host \
31+
grafana/grafana
32+
```
33+
34+
## Running
35+
36+
```bash
37+
# Build the Source (from the root)
38+
./build.sh
39+
40+
# Install (from the example directory)
41+
npm install
42+
43+
# Start a RabbitMQ Container (for the binding example part)
44+
# note: mgmt interface at http://localhost:15672
45+
docker run -d --rm --hostname my-rabbitmq --name my-rabbitmq \
46+
-e RABBITMQ_DEFAULT_USER=test-user -e RABBITMQ_DEFAULT_PASS=test-password \
47+
-p 0.0.0.0:5672:5672 -p 0.0.0.0:15672:15672 \
48+
rabbitmq:3-management
49+
50+
# Run the example
51+
npm run start:dapr
52+
```
53+
54+
```
55+
from(bucket: "my-sensors")
56+
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
57+
|> filter(fn: (r) => r["_measurement"] == "sensor-states")
58+
|> pivot(columnKey: ["_field"], rowKey: ["_time"], valueColumn: "_value")
59+
|> group()
60+
|> yield(name: "last")
61+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://docs.dapr.io/reference/components-reference/supported-bindings/influxdb/
2+
apiVersion: dapr.io/v1alpha1
3+
kind: Component
4+
metadata:
5+
name: binding-influxdb
6+
namespace: default
7+
spec:
8+
type: bindings.influx
9+
version: v1
10+
metadata:
11+
- name: url # Required
12+
value: "http://127.0.0.1:8086"
13+
- name: token # Required
14+
value: my-token
15+
- name: org # Required
16+
value: my-parking-garage
17+
- name: bucket # Required
18+
value: my-sensors
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://docs.dapr.io/reference/components-reference/supported-bindings/rabbitmq/
2+
apiVersion: dapr.io/v1alpha1
3+
kind: Component
4+
metadata:
5+
name: pubsub-redis
6+
namespace: default
7+
spec:
8+
type: pubsub.redis
9+
version: v1
10+
metadata:
11+
- name: redisHost
12+
value: localhost:6379
13+
- name: redisPassword
14+
value: ""
15+
- name: consumerID
16+
value: "myGroup"
17+
- name: enableTLS
18+
value: "false"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# https://docs.dapr.io/reference/components-reference/supported-bindings/rabbitmq/
2+
apiVersion: dapr.io/v1alpha1
3+
kind: Component
4+
metadata:
5+
name: state-redis
6+
namespace: default
7+
spec:
8+
type: state.redis
9+
version: v1
10+
metadata:
11+
- name: redisHost
12+
value: localhost:6379
13+
- name: redisPassword
14+
value: ""
15+
- name: enableTLS
16+
value: "false"
17+
- name: failover
18+
value: "false"
19+
- name: actorStateStore
20+
value: "true"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: dapr.io/v1alpha1
2+
kind: Configuration
3+
metadata:
4+
name: daprConfig
5+
spec:
6+
tracing:
7+
enabled: false

0 commit comments

Comments
 (0)