This workshop deploys compute, storage, networking, and an IoT application to Packet.com.
Diagram:
TBD via https://draw.io/
Component parts:
- Kubernetes - provisioned with Terraform
- MQTT Broker - emitter.io
- Compute platform - OpenFaaS
- MQTT Connector - openfaas-incubator/mqtt-connector
- Database/storage - Postgresql
Everything you need to deploy this workshop is available in this repository.
git clone https://github.com/packet-labs/iot
You will need to install Terraform for this step.
-
Set your Packet API and project ID in the .tf files in
/k8s
. -
Enter the
k8s
folder and apply the terraform plan.
You will need to install helm for this step.
- Install postgresql
- Install emitter
More info at: https://emitter.io
-
Navigate to
http://IP:port/keygen
whereIP
is the address of your Emitter.io deployment -
Generate a channel key for the topic
drone-position
You'll need this key to configure the OpenFaaS Connector
-
Install openfaas to provide compute and events
-
Deploy the OpenFaaS services for the application
The MQTT-Connector is used to trigger functions and services in response to messages generated by the event source.
The topic is drone-position
.
git clone https://github.com/openfaas-incubator/mqtt-connector
cd mqtt-connector
Edit chart/mqtt-connector/values.yaml
and update the CHANNEL_KEY value from the step above.
Apply the changes:
cd mqtt-connector/chart/
helm template -n openfaas --namespace openfaas mqtt-connector/ --values mqtt
-connector/values.yaml | kubectl apply -f -
-
Deploy business insights software
-
Create Python or Node app to publish generated MQTT data
-
Create Postgesql schema asset for drone geo-location data
-
Create OpenFaaS Function: insert row (using
node12
template) -
Create OpenFaaS service for viewing data on mapbox (using
node12
template) -
Create OpenFaaS Function: Query drone positions for mapbox (using
node12
template)
Suggested schema ('drone'):
- ID
- Name
- Altitude
- GPS Latitude
- GPS Longitude
- Velocity
- Battery
- Temperature