Skip to content

2.0.0

Choose a tag to compare

@github-actions github-actions released this 15 Jan 10:33
· 54 commits to main since this release

MSU Manager Service

This components manages various aspects for Mobilytix Sensoring Units among which are power and thermal management.
One of its core features is receiving commands from the HCU (Hardware Control Unit). It is shipped for Debian based Linux distributions and is tested with Ubuntu.

Local Development

App consists of two parts: Python backend and React frontend.

Build Frontend

Copy settings template in a new file and configure frontend values like so:

frontend:
  enabled: true
  path: 'frontend/dist'

Then run in folder frontend:

npm install
npm run build

Run backend

To run the application manually you can use Poetry:

poetry install
poetry run fastapi run msu_manager/main.py

Application will serve frontend under: http://localhost:8000. If you run npm start in frontend folder, you let npm compile React code on the fly.

Usage

Service is shipped as APT package, see release page to download latest package. How to configure and use service see manual.

Build

Here are all necessarey information for developers, to build and run service.

Prerequisites

Things you need to build package.

  • Python
  • Poetry
  • build-essentials
  • npm

Build APT package

Makefile has target to build an APT package. Virtual environment is created by exporting Poetry dependencies into a requirements.txt file. APT is build like so:

poetry self add poetry-plugin-export
make build-deb

APT package can then be found in folder target. You can test installation using Docker, however SystemD (probably) won't work.

docker run -it --rm -v ./target:/app  jrei/systemd-ubuntu:latest bash
apt update && apt install -y /app/msu-manager_0.0.7_all.deb

You can however test, if everything is installed to the right place. If you want to test service use the following examples:

curl localhost:8000/api/hcu/message -H "Content-Type: application/json" -d '{"type": "HEARTBEAT","version" : "0.0.3"}'
curl localhost:8000/api/hcu/message -H "Content-Type: application/json" -d '{"type": "LOG", "level": "info", "message": "temperature was read"}'
curl localhost:8000/api/hcu/message -H "Content-Type: application/json" -d '{"type": "METRIC", "key": "temp0", "value": "42.0"}'
curl localhost:8000/api/hcu/message -H "Content-Type: application/json" -d '{"type": "SHUTDOWN"}'
curl localhost:8000/api/hcu/message -H "Content-Type: application/json" -d '{"type": "RESUME"}'