diff --git a/README.md b/README.md index 0052555..eeea965 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,17 @@ The `system_monitor.py` must be installed on every node you wish to monitor. * Edit `node_config.json` to set the `client_id` (must match the ID in `clients.json`) and MQTT credentials. * (Recommended) Set up a systemd service to run the agent automatically at boot. +#### ⚙️ Running as a System Service (systemd) +To keep the system running continuously and start automatically at boot, use the provided `.service` files: + +1. Copy the appropriate file to the systemd directory: + * For Server: `sudo cp systemd/fleet-console.service /etc/systemd/system/` + * For Nodes: `sudo cp systemd/fleet-agent.service /etc/systemd/system/` +2. Reload the systemd daemon: `sudo systemctl daemon-reload` +3. Enable it to start on boot: `sudo systemctl enable fleet-console` (or `fleet-agent`) +4. Start the service: `sudo systemctl start fleet-console` +5. Check the status: `sudo systemctl status fleet-console` + --- @@ -104,5 +115,16 @@ Il file `system_monitor.py` va installato su ogni nodo che vuoi monitorare. * Modifica `node_config.json` impostando il `client_id` (deve corrispondere all'ID in `clients.json`) e le credenziali MQTT. * (Consigliato) Crea un servizio systemd per avviare l'agente automaticamente al boot. +#### ⚙️ Esecuzione come Servizio di Sistema (systemd) +Per mantenere il sistema sempre attivo e avviarlo in automatico all'accensione, usa i file `.service` forniti: + +1. Copia il file appropriato nella cartella di systemd: + * Per il Server: `sudo cp systemd/fleet-console.service /etc/systemd/system/` + * Per i Nodi: `sudo cp systemd/fleet-agent.service /etc/systemd/system/` +2. Ricarica i demoni di sistema: `sudo systemctl daemon-reload` +3. Abilita l'avvio automatico: `sudo systemctl enable fleet-console` (oppure `fleet-agent`) +4. Avvia il servizio: `sudo systemctl start fleet-console` +5. Controlla lo stato: `sudo systemctl status fleet-console` + --- *Created by IV3JDV @ ARIFVG - 2026* diff --git a/install.txt b/install.txt new file mode 100644 index 0000000..225787a --- /dev/null +++ b/install.txt @@ -0,0 +1,132 @@ +============================================================ + INSTALLATION GUIDE - FLEET CONTROL CONSOLE +============================================================ + +This guide describes the steps to install the Central +Dashboard and the Remote Agents on MMDVM nodes. + +------------------------------------------------------------ +1. PRE-REQUISITES +------------------------------------------------------------ +Ensure Python 3 is installed on all systems. +The necessary dependencies are listed in the +'requirements.txt' file. + +Install dependencies: + pip install -r requirements.txt + +------------------------------------------------------------ +2. SERVER SETUP (CENTRAL HUB) +------------------------------------------------------------ +The server handles the web interface and user permissions. + +Steps: +1. Configure 'config.json' using 'config.example.json' as a template. +2. Enter MQTT credentials and VAPID keys. +3. Define repeaters in the 'clients.json' file. +4. Start the server: + python3 app.py + +------------------------------------------------------------ +3. GENERATING VAPID KEYS (PUSH NOTIFICATIONS) +------------------------------------------------------------ +Required to enable browser and mobile notifications. + +1. Go to https://vapidkeys.com/ and generate the keys. +2. Copy 'Public Key' and 'Private Key' into 'config.json'. +3. Set 'vapid_claim_email' (e.g., "mailto:your@email.com"). + +------------------------------------------------------------ +4. AGENT SETUP (REMOTE NODES) +------------------------------------------------------------ +To be installed on each Raspberry Pi / MMDVM Node. + +1. Copy 'system_monitor.py' and 'node_config.json' to + '/opt/node_agent/'. +2. Edit 'node_config.json' with a unique 'client_id'. +3. (Optional) Install 'RPi.GPIO' for hardware reset. + +------------------------------------------------------------ +5. RUNNING AS A SERVICE (SYSTEMD) +------------------------------------------------------------ +For auto-start and process monitoring. + +Configuration: +1. Copy .service files to '/etc/systemd/system/': + - Server: sudo cp fleet-console.service /etc/systemd/system/ + - Nodes: sudo cp fleet-agent.service /etc/systemd/system/ +2. Reload systemd: + sudo systemctl daemon-reload +3. Enable start on boot: + sudo systemctl enable fleet-console (or fleet-agent) +4. Start the service: + sudo systemctl start fleet-console + + +============================================================ + GUIDA ALL'INSTALLAZIONE - FLEET CONTROL CONSOLE +============================================================ + +Questa guida descrive i passaggi per installare la Dashboard +Centrale e gli Agenti Remoti sui nodi MMDVM. + +------------------------------------------------------------ +1. REQUISITI PRELIMINARI +------------------------------------------------------------ +Assicurarsi di avere Python 3 installato su tutti i sistemi. +Le dipendenze necessarie sono elencate nel file +'requirements.txt'. + +Installazione dipendenze: + pip install -r requirements.txt + +------------------------------------------------------------ +2. SETUP DEL SERVER (HUB CENTRALE) +------------------------------------------------------------ +Il server gestisce l'interfaccia web e i permessi. + +Passaggi: +1. Configura 'config.json' partendo da 'config.example.json'. +2. Inserisci le credenziali MQTT e le chiavi VAPID. +3. Definisci i ripetitori nel file 'clients.json'. +4. Avvia il server: + python3 app.py + +------------------------------------------------------------ +3. GENERAZIONE CHIAVI VAPID (NOTIFICHE PUSH) +------------------------------------------------------------ +Necessarie per abilitare le notifiche su browser e mobile. + +1. Vai su https://vapidkeys.com/ e genera le chiavi. +2. Copia 'Public Key' e 'Private Key' nel 'config.json'. +3. Imposta 'vapid_claim_email' (es. "mailto:tua@email.com"). + +------------------------------------------------------------ +4. SETUP DELL'AGENTE (NODI REMOTI) +------------------------------------------------------------ +Da installare su ogni Raspberry Pi / Nodo MMDVM. + +1. Copia 'system_monitor.py' e 'node_config.json' in + '/opt/node_agent/'. +2. Modifica 'node_config.json' con il 'client_id' univoco. +3. (Opzionale) Installa 'RPi.GPIO' per il reset hardware. + +------------------------------------------------------------ +5. ESECUZIONE COME SERVIZIO (SYSTEMD) +------------------------------------------------------------ +Per l'avvio automatico e il monitoraggio del processo. + +Configurazione: +1. Copia i file .service in '/etc/systemd/system/': + - Server: sudo cp fleet-console.service /etc/systemd/system/ + - Nodi: sudo cp fleet-agent.service /etc/systemd/system/ +2. Ricarica systemd: + sudo systemctl daemon-reload +3. Abilita l'avvio al boot: + sudo systemctl enable fleet-console (oppure fleet-agent) +4. Avvia il servizio: + sudo systemctl start fleet-console + +------------------------------------------------------------ +Created by IV3JDV @ ARIFVG - 2026 +============================================================ diff --git a/systemd/fleet-agent.service b/systemd/fleet-agent.service new file mode 100644 index 0000000..80a4478 --- /dev/null +++ b/systemd/fleet-agent.service @@ -0,0 +1,15 @@ +[Unit] +Description=Fleet Control - Remote Node Agent +After=network.target + +[Service] +Type=simple +# Agent must be run as root for services restart (MMDVMHost etc.) and use GPIO +User=root +WorkingDirectory=/opt/node_agent +ExecStart=/usr/bin/python3 /opt/node_agent/system_monitor.py +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target diff --git a/systemd/fleet-control.service b/systemd/fleet-control.service new file mode 100644 index 0000000..d27fd88 --- /dev/null +++ b/systemd/fleet-control.service @@ -0,0 +1,19 @@ +[Unit] +Description=Fleet Control Console - Central Hub +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/web-control +ExecStart=/usr/bin/python3 /opt/web-control/app.py +Restart=always +RestartSec=5 + +# Ottimizzazioni per la gestione dei log +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=fleet-console + +[Install] +WantedBy=multi-user.target