-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
38 lines (28 loc) · 1.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
SPIN_VARIABLE_MQTT_BROKER_URI ?= "test.mosquitto.org"
SPIN_VARIABLE_MQTT_TOPIC ?= "booth/+"
REGISTRY ?= ghcr.io/fermyon/spin-mqtt-booth-volume
TAG ?= latest
VOLUME ?= 350
BOOTH ?= 20
BROKER_HOSTNAME ?= test.mosquitto.org
all: emqx spin-build-up
emqx:
docker run -d --name emqx -p 1883:1883 emqx/emqx
spin-build-up:
SPIN_VARIABLE_MQTT_BROKER_URI=${SPIN_VARIABLE_MQTT_BROKER_URI} SPIN_VARIABLE_MQTT_TOPIC=${SPIN_VARIABLE_MQTT_TOPIC} SPIN_VARIABLE_SQLITE_USERNAME="admin" SPIN_VARIABLE_SQLITE_PASSWORD="password" spin build --up --sqlite @mqtt-message-persister/migration.up.sql
spin-up:
SPIN_VARIABLE_MQTT_BROKER_URI=${SPIN_VARIABLE_MQTT_BROKER_URI} SPIN_VARIABLE_MQTT_TOPIC=${SPIN_VARIABLE_MQTT_TOPIC} SPIN_VARIABLE_SQLITE_USERNAME="admin" SPIN_VARIABLE_SQLITE_PASSWORD="password" spin up --sqlite @mqtt-message-persister/migration.up.sql
pub:
mqttx pub -t 'booth/${BOOTH}' --hostname ${BROKER_HOSTNAME} --port 1883 --message '{"volume": ${VOLUME}}'
clean:
docker rm -f emqx
app-apply:
spin kube scaffold --from ${REGISTRY}:${TAG} --variable mqtt_broker_uri=${SPIN_VARIABLE_MQTT_BROKER_URI} --variable mqtt_topic="booth/+" --variable sqlite_username="admin" --variable sqlite_password=password --replicas 1 | kubectl apply -f -
emqx-apply:
kubectl apply -f spinkube/broker-configuration/emqx-pod.yaml
mock-device-apply:
kubectl apply -f spinkube/sound-device.yaml
k8s-clean:
kubectl delete -f spinkube/broker.yaml
kubectl delete -f spinkube/sound-device.yaml
spin kube scaffold --from ${REGISTRY}:${TAG} | kubectl delete -f -