From e6f09c8f3ea9f9bebea7a41ee8081612acc20109 Mon Sep 17 00:00:00 2001 From: matde-je Date: Thu, 21 Aug 2025 16:51:42 +0100 Subject: [PATCH 1/2] added services documentetions --- services_raspberryPi/autonomy-mqtt-cloud.service | 14 ++++++++++++++ services_raspberryPi/autonomy-mqtt-local.service | 14 ++++++++++++++ services_raspberryPi/battery-mqtt-cloud.service | 14 ++++++++++++++ services_raspberryPi/can-manager.service | 12 ++++++++++++ services_raspberryPi/github-runner.service | 15 +++++++++++++++ services_raspberryPi/speed-mqtt-cloud.service | 15 +++++++++++++++ services_raspberryPi/speed-mqtt-local.service | 15 +++++++++++++++ .../temperature-mqtt-cloud.service | 16 ++++++++++++++++ 8 files changed, 115 insertions(+) create mode 100644 services_raspberryPi/autonomy-mqtt-cloud.service create mode 100644 services_raspberryPi/autonomy-mqtt-local.service create mode 100644 services_raspberryPi/battery-mqtt-cloud.service create mode 100644 services_raspberryPi/can-manager.service create mode 100644 services_raspberryPi/github-runner.service create mode 100644 services_raspberryPi/speed-mqtt-cloud.service create mode 100644 services_raspberryPi/speed-mqtt-local.service create mode 100644 services_raspberryPi/temperature-mqtt-cloud.service diff --git a/services_raspberryPi/autonomy-mqtt-cloud.service b/services_raspberryPi/autonomy-mqtt-cloud.service new file mode 100644 index 000000000..ce55d82ee --- /dev/null +++ b/services_raspberryPi/autonomy-mqtt-cloud.service @@ -0,0 +1,14 @@ +[Unit] +Description=Car Autonomy Publisher Cloud +After=network-online.target mosquitto.service autonomy-mqtt-local.service +Wants=network-online.target autonomy-mqtt-local.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/autonomy_mqtt_cloud +Restart=always +RestartSec=5 +User=jetracer + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/autonomy-mqtt-local.service b/services_raspberryPi/autonomy-mqtt-local.service new file mode 100644 index 000000000..27f352d86 --- /dev/null +++ b/services_raspberryPi/autonomy-mqtt-local.service @@ -0,0 +1,14 @@ +[Unit] +Description=Car Autonomy Calculator and Publisher +After=network-online.target mosquitto.service +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/autonomy_mqtt_local +Restart=always +RestartSec=5 +User=jetracer + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/battery-mqtt-cloud.service b/services_raspberryPi/battery-mqtt-cloud.service new file mode 100644 index 000000000..c2dea1b3b --- /dev/null +++ b/services_raspberryPi/battery-mqtt-cloud.service @@ -0,0 +1,14 @@ +[Unit] +Description=Battery MQTT Cloud Publisher +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/battery_mqtt_cloud +Restart=always +RestartSec=5 +User=jetracer + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/can-manager.service b/services_raspberryPi/can-manager.service new file mode 100644 index 000000000..1fe953357 --- /dev/null +++ b/services_raspberryPi/can-manager.service @@ -0,0 +1,12 @@ +[Unit] +Description=CAN Interface Manager (Activate, Monitor, Deactivate) +After=network.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/can_manager +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/github-runner.service b/services_raspberryPi/github-runner.service new file mode 100644 index 000000000..f91475fc2 --- /dev/null +++ b/services_raspberryPi/github-runner.service @@ -0,0 +1,15 @@ +[Unit] +Description=GitHub Actions Self-Hosted Runner +After=network.target + +[Service] +Type=simple +User=jetracer +WorkingDirectory=/home/jetracer/actions-runner +ExecStart=/home/jetracer/actions-runner/run.sh +Restart=always +RestartSec=10 +Environment=RUNNER_ALLOW_RUNASROOT=1 + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/speed-mqtt-cloud.service b/services_raspberryPi/speed-mqtt-cloud.service new file mode 100644 index 000000000..f5d92331a --- /dev/null +++ b/services_raspberryPi/speed-mqtt-cloud.service @@ -0,0 +1,15 @@ +[Unit] +Description=Service to publish speed data to the cloud MQTT broker +BindsTo=speed-mqtt-local.service +Requires=speed-mqtt-local.service +After=network-online.target speed-mqtt-local.service +PartOf=speed-mqtt-local.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/speed_mqtt_cloud +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/speed-mqtt-local.service b/services_raspberryPi/speed-mqtt-local.service new file mode 100644 index 000000000..04f317805 --- /dev/null +++ b/services_raspberryPi/speed-mqtt-local.service @@ -0,0 +1,15 @@ +[Unit] +Description=MQTT Speed Publisher +BindsTo=can-manager.service +Requires=can-manager.service mosquitto.service +After=network.target can-manager.service mosquitto.service +PartOf=can-manager.service + +[Service] +Type=simple +ExecStart=/usr/local/bin/speed_mqtt_local +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/services_raspberryPi/temperature-mqtt-cloud.service b/services_raspberryPi/temperature-mqtt-cloud.service new file mode 100644 index 000000000..3bdbf5cee --- /dev/null +++ b/services_raspberryPi/temperature-mqtt-cloud.service @@ -0,0 +1,16 @@ +[Unit] +Description=Service to forward Raspberry Pi temperature from local to cloud MQTT broker +BindsTo=temperature-mqtt-local +Requires=temperature-mqtt-local +After=network-online.target temperature-mqtt-local +PartOf=temperature-mqtt-local + +[Service] +Type=simple +ExecStart=/usr/local/bin/temperature_mqtt_cloud +Restart=always +RestartSec=5 +User=jetracer + +[Install] +WantedBy=multi-user.target From 2f61cfc9b619cca1043edd5ab1aabafc2217066f Mon Sep 17 00:00:00 2001 From: matde-je Date: Thu, 21 Aug 2025 17:28:16 +0100 Subject: [PATCH 2/2] added readme --- services_raspberryPi/README.MD | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 services_raspberryPi/README.MD diff --git a/services_raspberryPi/README.MD b/services_raspberryPi/README.MD new file mode 100644 index 000000000..83938dd57 --- /dev/null +++ b/services_raspberryPi/README.MD @@ -0,0 +1,44 @@ +## 📑 Services Documentation - Raspberry Pi + +This document describes the services configured on the **Raspberry Pi** to automate and manage local processes. + + +## 📌 Overview +The services listed here were created to keep scripts and applications running automatically after system boot, ensuring that critical tasks run continuously. + + +## 🔧 Created Services + +### 1. **Service** +- **Description:** + **autonomy-mqtt-cloud.service** → Publishes car autonomy data to the cloud via MQTT. + + **autonomy-mqtt-local.service** → Calculates and publishes car autonomy data locally via MQTT. + + **battery-mqtt-cloud.service** → Publishes battery status to the cloud via MQTT. + + **can-manager.service** → Manages the CAN interface (activate, monitor, deactivate). + + **github-runner.service** → Runs GitHub Actions self-hosted runner on the Raspberry Pi. + + **speed-mqtt-cloud.service** → Publishes car speed data to the cloud via MQTT. + + **speed-mqtt-local.service** → Publishes car speed data locally via MQTT. + + **temperature-mqtt-cloud.service** → Publishes Raspberry Pi temperature data from local to the cloud via MQTT. +- **File location:** + `/etc/systemd/system` +- **Usage commands:** + + ```bash + # Start the service + sudo systemctl start service_name + + # Stop the service + sudo systemctl stop service_name + + # Restart the service + sudo systemctl restart service_name + + # Check status + sudo systemctl status service_name