demo-svc
is a Microservice Architecture implementation which is currently formed of the following
services and components:
-
hawkbit-fota
service consists of a frontend server which provides RESTful APIs to manage images, distributions, and deployments to be deployed tohawkbit-fota
clients. And a backend server which implements Hawkbit DDI compliant RESTful APIs so thathawkbit-fota
clients could poll and launch FOTA processes. -
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
implements ahawkbit-fota
client as the frontend to retrive FOTA deployments fromhawkbit-fota
service backend by polling and launching FOTA processes by RESTful APIs theHawkbit
backend offers. The backend ofmcumgr-svc
implementsupload
andreset
methods of mcumgr to update the firmware of the connectedslcan
devcice. -
Since both
slcan-svc
andmcumgr-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 whenslcan-svc
has released the serial port and put theslcan
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.
- Raspberry Pi ARM64
- minikube ARM64
- socat
- An slcan device
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"
hawkbit-fota and slcan-svc maintain their API documentation using Swagger UI.