Backend system for the Automotive App Project.
This repo has the code of our microservices that will process vehicle's telemetry data, detect all the events and send them to a message broker, to later be shown in the frontend.
We also have scripts to deploy the cloud2edge environment as well as tests (via pytest) to serve as simulations, so that the entirety of our project can be replicated and tested locally.
Even though our script will install all the necessary tools in case they aren't installed, if you prefer to install them manually, please refer to Eclipse's pre-requisites page with the tools required to deploy the cloud2edge environment.
Be sure that the machine where you will deploy this meets the necessary hardware requirements.
If you follow instructions, you will be able to deploy the cloud2edge environment, start the services and run tests locally.
Warnings:
Due to the fact that some images on c2e are outdated (see issue) we had to manually update them and automate this process. And even though it worked on our machines, you might encounter some new issues when deploying the cloud2edge environment, if that happens, please refer to the issues page.
git clone https://github.com/ATNoG/pei-automotive-backend.git
cd pei-automotive-backendThis script will:
- Install all the necessary tools (k3s and helm) in case they aren't installed.
- Clone the cloud2edge repo and update it's Chart referenced versions.
- Create the custom values.yaml file.
- Install the cloud2edge package with the custom versions and the custom values.yaml file, using helm.
- Confirm all the pods are running like it's supposed to.
- Make a .env file with the necessary variables for the backend services.
chmod +x deploy.sh
./deploy.shIf you want to stop the containers running and remove the namespace, you can run the stop.sh script.
docker compose up --buildThis will start:
- Position Processor
- Speed Detector service
- Overtaking Detector service
- Mosquitto MQTT Broker (message broker)
And that's it! The cloud2edge is deployed and the backend services are running. You can now start using the system with tests and/or even build the frontend.
Create a new vehicle digital twin and register it with Hono:
cd simulations
python3 create_car.py <car_name>This will:
- Register the device in Eclipse Hono
- Create a digital twin in Eclipse Ditto
- Generate metadata file in
simulations/devices/<car_name>.json
Send GPS position updates for a vehicle:
python3 send_position.py <car_name> <latitude> <longitude>Install the required dependencies:
pip install -r requirements.txtRun the test suite:
# Test speed detection
pytest tests/test_speeding.py
# Test overtaking detection
pytest tests/test_overtaking.py
# Test route with curves
pytest tests/test_curved_route.pyCheck latency on our system:
cd timing
python3 measure_latency.py <car_name>See LICENSE file for details.