Skip to content

A Kubernetes orchestrated Microservice architecture for IoT control & FOTA

License

Notifications You must be signed in to change notification settings

jonathanyhliang/demo-svc

Repository files navigation

Demo Microservice Architecture

Overview

demo-svc is a Microservice Architecture implementation which is currently formed of the following services and components:

  • hawkbit-fota

    hawkbit-fota service consists of a frontend server which provides RESTful APIs to manage images, distributions, and deployments to be deployed to hawkbit-fota clients. And a backend server which implements Hawkbit DDI compliant RESTful APIs so that hawkbit-fota clients could poll and launch FOTA processes.

  • slcan-svc

    slcan-svc service is capable of bridging serial-line CAN communication via RESTful APIs. The serial-line backend of the service is partially Serial-Line CAN compliant for interfacing a slcan end device.

  • mcumgr-svc

    mcumgr-svc implements a hawkbit-fota client as the frontend to retrive FOTA deployments from hawkbit-fota service backend by polling and launching FOTA processes by RESTful APIs the Hawkbit backend offers. The backend of mcumgr-svc implements upload and reset methods of mcumgr to update the firmware of the connected slcan devcice.

  • rabbitmq

    Since both slcan-svc and mcumgr-svc deal with the same serial port, an inter-service measure is required to make a sequencial transitioning of the interface from one to the other. rabbitmq is utilised here so that when slcan-svc has released the serial port and put the slcan device into firmware update mode, mcumgr-svc is informed to launch the update process.

Part of the work to demonstrate this Microservice Architecture is to develop an slcan device and a hawkbit-fota client device to interact with the Microservice. A fork of zephyrproject-rtos/zephyr has been added with an slcan sample application which runs on ST Nucleo F446RE board, and the existing Hawkbit FOTA client sample application has been patched to support CC3220SF LaunchXL WIFI board bring-up.

Prerequisite

Building and Running

Start a socat server process which listens to tcp:80 and links to the serial port of slcan device. (/dev/ttyACM0 in this example)

sudo socat tcp-l:80,reuseaddr,fork file:/dev/ttyACM0,nonblock,waitlock=/var/run/ttyACM0.lock &

Enable the Ingress controller:

minikube addons enable ingress

Install the RabbitMQ Cluster Operator:

kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml"

Create a RabbitMQ Cluster. It could take serveral minutes for RabbitMQ Cluster to get ready.

kubectl apply -f demo-svc-rabbitmq.yaml

Create a hawkbit deployment. This deploys a pod that hawkbit-svc is running on, and a servie that expsoe the frontend and backend ports. mcrmgr-svc depends on the backend port of hawkbit-svc exposed.

kubectl apply -f demo-svc-hawkbit.yaml

Create an slcan deployment. This deploys an slcan-svc and an mcumgr-svc Wait until both slcan-svc and mcumgr-svc are in running state

kubectl apply -f demo-svc-slcan.yaml

Try retriving an slcan message by:

curl --resolve "demo.svc:80:$( minikube ip )" \
      -i http://demo.svc/wired/slcan/123 \
      -H "Content-Type: application/json" \
      -X "GET"

API Documentation

hawkbit-fota and slcan-svc maintain their API documentation using Swagger UI.

docs/swag-hawkbit-fota.PNG

References

About

A Kubernetes orchestrated Microservice architecture for IoT control & FOTA

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published