Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7ba28dd02a
|
|||
|
d2feb67cef
|
|||
|
69749411cd
|
|||
|
364ada37c4
|
|||
|
89148d446e
|
|||
|
8865fe85ab
|
|||
|
2e0d3f4a6e
|
|||
|
e8e4cce689
|
|||
| 5ca7adc1f2 | |||
| a147162736 | |||
| 0c4b1e45be | |||
| de3e8fc68c | |||
| 2be89da897 | |||
| acd445a479 | |||
| 71a1cd32c3 |
@@ -49,17 +49,22 @@ The server acts as the brain of the network:
|
||||
|
||||
### 🚀 Installation Guide
|
||||
|
||||
#### 1. System Pre-requisites (Critical)
|
||||
#### 0. System Pre-requisites (Critical)
|
||||
Before installing Python dependencies, install the necessary system compilers and pip/venv tools. On Debian/Ubuntu:
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
||||
```
|
||||
|
||||
#### 1. Clone Repository
|
||||
Clone the repository into the /opt directory to ensure all systemd paths work correctly:
|
||||
```bash
|
||||
sudo git clone https://tuo-gitea.com/utente/fleet-control-server.git /opt/fleet-control-server
|
||||
cd /opt/fleet-control-server
|
||||
```
|
||||
#### 2. Virtual Environment Setup (Recommended)
|
||||
To prevent conflicts with OS packages (PEP 668), create an isolated environment:
|
||||
```bash
|
||||
cd /opt/web-control-server
|
||||
cd /opt/fleet-control-server
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip setuptools wheel
|
||||
@@ -75,10 +80,10 @@ pip install -r requirements.txt
|
||||
#### 4. Running as a Service
|
||||
To run the server continuously in production using Gunicorn:
|
||||
```bash
|
||||
sudo cp fleet-control.service /etc/systemd/system/
|
||||
sudo cp fleet-console.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable fleet-control
|
||||
sudo systemctl start fleet-control
|
||||
sudo systemctl enable fleet-console
|
||||
sudo systemctl start fleet-console
|
||||
```
|
||||
*(Ensure the `.service` file points to the `gunicorn` executable inside your `venv`)*.
|
||||
|
||||
@@ -129,17 +134,22 @@ Il server agisce da cervello della rete:
|
||||
|
||||
### 🚀 Guida all'Installazione
|
||||
|
||||
#### 1. Requisiti di Sistema (Critici)
|
||||
#### 0. Requisiti di Sistema (Critici)
|
||||
Prima di installare le dipendenze Python, installa i compilatori di base e gli strumenti per gli ambienti virtuali. Su Debian/Ubuntu:
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
||||
```
|
||||
|
||||
#### 1. Clonazione dei Repository
|
||||
Clona il repository nella cartella /opt per assicurarti che tutti i percorsi dei servizi systemd siano corretti:
|
||||
```bash
|
||||
sudo git clone https://tuo-gitea.com/utente/fleet-control-server.git /opt/fleet-control-server
|
||||
cd /opt/fleet-control-server
|
||||
```
|
||||
#### 2. Setup Ambiente Virtuale (Consigliato)
|
||||
Per evitare conflitti con i pacchetti di sistema (regola PEP 668), crea una "bolla" isolata:
|
||||
```bash
|
||||
cd /opt/web-control-server
|
||||
cd /opt/fleet-control-server
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip setuptools wheel
|
||||
@@ -155,10 +165,10 @@ pip install -r requirements.txt
|
||||
#### 4. Esecuzione come Servizio (systemd)
|
||||
Per eseguire il server in produzione in modo continuo e stabile con Gunicorn:
|
||||
```bash
|
||||
sudo cp fleet-control.service /etc/systemd/system/
|
||||
sudo cp fleet-console.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable fleet-control
|
||||
sudo systemctl start fleet-control
|
||||
sudo systemctl enable fleet-console
|
||||
sudo systemctl start fleet-console
|
||||
```
|
||||
*(Assicurati che il file `.service` punti all'eseguibile `gunicorn` situato all'interno della cartella `venv`).*
|
||||
|
||||
|
||||
-144
@@ -1,144 +0,0 @@
|
||||
# 📡 Fleet Control Console (Server)
|
||||
|
||||
🌍 *[Read in English](#english) | 🇮🇹 [Leggi in Italiano](#italiano)*
|
||||
|
||||
---
|
||||
|
||||
<a name="english"></a>
|
||||
## 🇬🇧 English
|
||||
|
||||
**Fleet Control Console** is a professional, real-time command and control (C2) dashboard designed for amateur radio repeater networks (MMDVM).
|
||||
|
||||

|
||||
|
||||
### 🤖 Remote Agent
|
||||
To monitor your remote nodes (Raspberry Pi), download the dedicated lightweight agent here:
|
||||
`https://git.arifvg.it/iv3jdv/web-console-agent.git`
|
||||
|
||||
### ✨ Features
|
||||
* **Zero-Latency Real-Time UI:** Powered by WebSockets (Socket.IO).
|
||||
* **Web Push Notifications:** Instant alerts on desktop or mobile.
|
||||
* **Centralized Telemetry & Service Management.**
|
||||
* **Global Operations:** Switch profiles instantly.
|
||||
|
||||
### 🚀 Installation & Setup
|
||||
|
||||
------------------------------------------------------------
|
||||
1. PRE-REQUISITES (CRITICAL)
|
||||
------------------------------------------------------------
|
||||
Before installing Python dependencies, you must install
|
||||
system compilers and development libraries.
|
||||
|
||||
Debian/Ubuntu:
|
||||
sudo apt update
|
||||
sudo apt install build-essential python3-dev libssl-dev libffi-dev
|
||||
|
||||
Upgrade base pip tools:
|
||||
pip install --upgrade pip setuptools wheel
|
||||
|
||||
Create a virtual environment (Recommended):
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
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'.
|
||||
2. Enter MQTT credentials and VAPID keys.
|
||||
3. Define repeaters in the 'clients.json' file.
|
||||
4. Install production WSGI server packages (if not in requirements):
|
||||
pip install gunicorn gevent gevent-websocket
|
||||
5. Start the production server:
|
||||
gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -w 1 --bind 0.0.0.0:9000 app:app
|
||||
|
||||
------------------------------------------------------------
|
||||
3. GENERATING VAPID KEYS (PUSH NOTIFICATIONS)
|
||||
------------------------------------------------------------
|
||||
⚠️ WARNING: Web Push Notifications strictly require the
|
||||
dashboard to be accessed via a secure HTTPS connection.
|
||||
They will NOT work over standard HTTP.
|
||||
|
||||
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. RUNNING AS A SERVICE (SYSTEMD)
|
||||
------------------------------------------------------------
|
||||
Configuration:
|
||||
1. Copy .service file to '/etc/systemd/system/':
|
||||
sudo cp fleet-console.service /etc/systemd/system/
|
||||
2. Reload systemd: sudo systemctl daemon-reload
|
||||
3. Enable on boot: sudo systemctl enable fleet-console
|
||||
4. Start service: sudo systemctl start fleet-console
|
||||
|
||||
<a name="italiano"></a>
|
||||
## 🇮🇹 Italiano
|
||||
|
||||
**Fleet Control Console** è una dashboard di comando e controllo (C2) professionale in tempo reale per le reti di ripetitori radioamatoriali (MMDVM).
|
||||
|
||||

|
||||
|
||||
### 🤖 Agente Remoto
|
||||
Per monitorare i tuoi nodi remoti (Raspberry Pi), scarica l'agente dedicato qui:
|
||||
`https://git.arifvg.it/iv3jdv/web-console-agent.git`
|
||||
|
||||
### ✨ Funzionalità
|
||||
* **Interfaccia Real-Time a Latenza Zero** tramite WebSockets.
|
||||
* **Notifiche Push Web** per allarmi critici.
|
||||
* **Telemetria Centralizzata e Gestione Servizi.**
|
||||
* **Operazioni Globali** su tutta la rete.
|
||||
|
||||
### 🚀 Installazione
|
||||
|
||||
------------------------------------------------------------
|
||||
1. REQUISITI PRELIMINARI (CRITICI)
|
||||
------------------------------------------------------------
|
||||
Prima di installare le dipendenze Python, è necessario
|
||||
installare i compilatori di sistema. Senza questi,
|
||||
l'installazione di 'gevent' fallirà su VPS vergini.
|
||||
|
||||
Esegui su Debian/Ubuntu:
|
||||
sudo apt update
|
||||
sudo apt install build-essential python3-dev libssl-dev libffi-dev
|
||||
|
||||
Aggiorna gli strumenti di base di pip:
|
||||
pip install --upgrade pip setuptools wheel
|
||||
|
||||
Crea un ambiente virtuale (consigliato):
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install -r requirements.txt
|
||||
|
||||
------------------------------------------------------------
|
||||
2. SETUP DEL SERVER
|
||||
------------------------------------------------------------
|
||||
Passaggi:
|
||||
1. Configura 'config.json' partendo da 'config.example.json'.
|
||||
2. Inserisci credenziali MQTT e chiavi VAPID.
|
||||
3. Definisci i ripetitori in 'clients.json'.
|
||||
4. Avvia il server di produzione:
|
||||
gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -w 1 --bind 0.0.0.0:9000 app:app
|
||||
|
||||
------------------------------------------------------------
|
||||
3. GENERAZIONE CHIAVI VAPID
|
||||
------------------------------------------------------------
|
||||
⚠️ ATTENZIONE: Le notifiche push richiedono HTTPS.
|
||||
|
||||
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. ESECUZIONE COME SERVIZIO
|
||||
------------------------------------------------------------
|
||||
1. sudo cp fleet-console.service /etc/systemd/system/
|
||||
2. sudo systemctl daemon-reload
|
||||
3. sudo systemctl enable fleet-console
|
||||
4. sudo systemctl start fleet-console
|
||||
---
|
||||
*Created by IV3JDV @ ARIFVG - 2026*
|
||||
@@ -670,37 +670,55 @@ def global_cmd():
|
||||
return jsonify({"success": True})
|
||||
|
||||
def auto_update_ids():
|
||||
while True:
|
||||
"""Versione corretta: controlla all'avvio e poi ogni notte."""
|
||||
|
||||
def download_logic():
|
||||
try:
|
||||
# Usiamo esattamente i nomi e le URL definiti nel tuo config/codice
|
||||
with open(CONFIG_PATH, 'r') as f:
|
||||
current_cfg = json.load(f)
|
||||
target_time = current_cfg.get("update_schedule", "03:00")
|
||||
|
||||
urls = current_cfg.get("id_urls", {
|
||||
"dmr": "https://radioid.net/static/users.csv",
|
||||
"nxdn": "https://radioid.net/static/nxdn.csv"
|
||||
})
|
||||
now = time.strftime("%H:%M")
|
||||
if now == target_time:
|
||||
logger.info(f">>> [AUTO-UPDATE] Scheduled time reached ({now}). Downloading...")
|
||||
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}
|
||||
logger.info("📡 Inizio download database ID (DMR e NXDN)...")
|
||||
|
||||
# Download DMR -> dmrid.dat
|
||||
req_dmr = urllib.request.Request(urls["dmr"], headers=headers)
|
||||
with urllib.request.urlopen(req_dmr) as response, open(DMR_IDS_PATH, 'wb') as out_file:
|
||||
out_file.write(response.read())
|
||||
|
||||
# Trucco: Camuffiamo Python da browser per bypassare i blocchi Cloudflare
|
||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'}
|
||||
# Download NXDN -> nxdn.csv
|
||||
req_nxdn = urllib.request.Request(urls["nxdn"], headers=headers)
|
||||
with urllib.request.urlopen(req_nxdn) as response, open(NXDN_IDS_PATH, 'wb') as out_file:
|
||||
out_file.write(response.read())
|
||||
|
||||
# Download DMR
|
||||
req_dmr = urllib.request.Request(urls["dmr"], headers=headers)
|
||||
with urllib.request.urlopen(req_dmr) as response, open(DMR_IDS_PATH, 'wb') as out_file:
|
||||
out_file.write(response.read())
|
||||
|
||||
# Download NXDN
|
||||
req_nxdn = urllib.request.Request(urls["nxdn"], headers=headers)
|
||||
with urllib.request.urlopen(req_nxdn) as response, open(NXDN_IDS_PATH, 'wb') as out_file:
|
||||
out_file.write(response.read())
|
||||
|
||||
load_ids()
|
||||
logger.info(f">>> [AUTO-UPDATE] Completed successfully.")
|
||||
time.sleep(65)
|
||||
load_ids()
|
||||
logger.info("✅ Aggiornamento completato con successo.")
|
||||
except Exception as e:
|
||||
logger.error(f">>> [AUTO-UPDATE] Error: {e}")
|
||||
logger.error(f"❌ Errore durante il download: {e}")
|
||||
|
||||
# --- CONTROLLO INIZIALE ALL'AVVIO ---
|
||||
if not os.path.exists(DMR_IDS_PATH) or not os.path.exists(NXDN_IDS_PATH):
|
||||
logger.info("🔍 File ID mancanti. Avvio download immediato...")
|
||||
download_logic()
|
||||
|
||||
# --- CICLO NOTTURNO ---
|
||||
while True:
|
||||
try:
|
||||
now = time.strftime("%H:%M")
|
||||
with open(CONFIG_PATH, 'r') as f:
|
||||
target_time = json.load(f).get("update_schedule", "03:00")
|
||||
|
||||
if now == target_time:
|
||||
logger.info(f"⏰ Orario programmato ({target_time}) raggiunto. Aggiorno...")
|
||||
download_logic()
|
||||
time.sleep(65)
|
||||
except Exception as e:
|
||||
logger.error(f"⚠️ Errore nel thread update: {e}")
|
||||
time.sleep(30)
|
||||
|
||||
@app.route('/api/ui_config', methods=['GET'])
|
||||
|
||||
+8
-8
@@ -13,7 +13,7 @@ Debian/Ubuntu:
|
||||
sudo apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
||||
|
||||
Create and activate a virtual environment (CRITICAL on Debian 12+):
|
||||
cd /opt/web-control-server
|
||||
cd /opt/fleet-control-server
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
|
||||
@@ -56,12 +56,12 @@ open 'fleet-control.service' and ensure the paths point to your
|
||||
virtual environment.
|
||||
|
||||
Example:
|
||||
WorkingDirectory=/opt/web-control-server
|
||||
ExecStart=/opt/web-control-server/venv/bin/gunicorn -k ...
|
||||
WorkingDirectory=/opt/fleet-control-server
|
||||
ExecStart=/opt/fleet-control-server/venv/bin/gunicorn -k ...
|
||||
|
||||
Configuration:
|
||||
1. Copy .service file to '/etc/systemd/system/':
|
||||
sudo cp fleet-control.service /etc/systemd/system/
|
||||
sudo cp fleet-console.service /etc/systemd/system/
|
||||
2. Reload systemd: sudo systemctl daemon-reload
|
||||
3. Enable on boot: sudo systemctl enable fleet-console
|
||||
4. Start service: sudo systemctl start fleet-console
|
||||
@@ -82,7 +82,7 @@ Esegui su Debian/Ubuntu:
|
||||
sudo apt install build-essential python3-dev libssl-dev libffi-dev python3-pip python3-venv
|
||||
|
||||
Crea e attiva un ambiente virtuale (FONDAMENTALE su Debian 12+):
|
||||
cd /opt/web-control-server
|
||||
cd /opt/fleet-control-server
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
|
||||
@@ -118,11 +118,11 @@ servizio, apri 'fleet-control.service' e assicurati che i percorsi
|
||||
puntino al tuo ambiente virtuale!
|
||||
|
||||
Esempio:
|
||||
WorkingDirectory=/opt/web-control-server
|
||||
ExecStart=/opt/web-control-server/venv/bin/gunicorn -k ...
|
||||
WorkingDirectory=/opt/fleet-control-server
|
||||
ExecStart=/opt/fleet-control-server/venv/bin/gunicorn -k ...
|
||||
|
||||
Passaggi:
|
||||
1. Copia il file in systemd: sudo cp fleet-control.service /etc/systemd/system/
|
||||
1. Copia il file in systemd: sudo cp fleet-console.service /etc/systemd/system/
|
||||
2. Ricarica la configurazione: sudo systemctl daemon-reload
|
||||
3. Abilita all'avvio: sudo systemctl enable fleet-console
|
||||
4. Avvia il servizio: sudo systemctl start fleet-console
|
||||
|
||||
@@ -6,9 +6,9 @@ After=network.target
|
||||
Type=simple
|
||||
User=root
|
||||
# Assicurati che questo sia il percorso esatto della cartella del tuo progetto
|
||||
WorkingDirectory=/opt/web-control-server
|
||||
WorkingDirectory=/opt/fleet-control-server
|
||||
# PUNTA AL GUNICORN DENTRO IL VENV!
|
||||
ExecStart=/opt/web-control-server/venv/bin/gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -w 1 --graceful-timeout 2 --bind 0.0.0.0:9000 app:app
|
||||
ExecStart=/opt/fleet-control-server/venv/bin/gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" -w 1 --graceful-timeout 2 --bind 0.0.0.0:9000 app:app
|
||||
TimeoutStopSec=3
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
+155
-448
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user