Repository navigation
2.0.0
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 buildRun backend
To run the application manually you can use Poetry:
poetry install
poetry run fastapi run msu_manager/main.pyApplication 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-debAPT 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.debYou 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"}'