From 432e45585378cf6bf9395b116fd51d0d340c4754 Mon Sep 17 00:00:00 2001 From: Logan Date: Tue, 21 Apr 2026 01:51:40 -0400 Subject: [PATCH] Add updates --- drb-edge-node/app/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drb-edge-node/app/main.py b/drb-edge-node/app/main.py index 795a8ff..85dbcf7 100644 --- a/drb-edge-node/app/main.py +++ b/drb-edge-node/app/main.py @@ -74,6 +74,18 @@ async def on_command(payload: dict): await op25_client.stop() await asyncio.sleep(2) await op25_client.start() + elif action == "node_update": + # TODO: Full OTA update — register a host-level systemd service (e.g. drb-update.service) + # that stops all DRB containers, runs `docker compose pull`, then `docker compose up -d`. + # The C2 server triggers it by sending this MQTT command; the host service watches for the + # restart signal (e.g. via a Unix socket, a sentinel file, or a lightweight webhook). + # Not implemented yet — for now, just restart the container so any pre-pulled image + # is picked up (requires a prior `docker compose pull` on the host). + logger.info("Node update requested — restarting container to pick up latest image.") + await mqtt_manager.publish_status("offline") + await asyncio.sleep(1) + import os + os._exit(0) # Docker restart=unless-stopped will bring the container back up else: logger.warning(f"Unknown command: {action}")