 ./deployment/update_from_git.sh --db

╔═══════════════════════════════════════════════╗
║    AGGIORNAMENTO SISTEMA IDS DA GIT         ║
╚═══════════════════════════════════════════════╝

 Verifica configurazione git...

 Backup configurazione locale...
✅ .env salvato in .env.backup

 Verifica modifiche locali...
⚠  Ci sono modifiche locali non committate
   Esegui 'git status' per vedere i dettagli
Vuoi procedere comunque? (y/n) y
   Salvo modifiche locali temporaneamente...
No local changes to save

 Download aggiornamenti da git.alfacom.it...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 16 (delta 13), reused 0 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (16/16), 4.03 KiB | 295.00 KiB/s, done.
From https://git.alfacom.it/marco/ids.alfacom.it
   40f8f05..14645c5  main       -> origin/main
 * [new tag]         v1.0.113   -> v1.0.113
From https://git.alfacom.it/marco/ids.alfacom.it
 * branch            main       -> FETCH_HEAD
Updating 40f8f05..14645c5
Fast-forward
 client/src/pages/Training.tsx |  65 +++++++++++++++++++++++++++++++++++++++++++++++++----------------
 database-schema/schema.sql    |   4 ++--
 replit.md                     |   2 +-
 server/routes.ts              | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------
 version.json                  |  16 ++++++++--------
 5 files changed, 149 insertions(+), 76 deletions(-)
✅ Aggiornamenti scaricati con successo

 Ripristino configurazione locale...
✅ .env ripristinato

 Aggiornamento dipendenze Node.js...

up to date, audited 492 packages in 5s

65 packages are looking for funding
  run `npm fund` for details

13 vulnerabilities (3 low, 6 moderate, 4 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
✅ Dipendenze Node.js aggiornate

 Aggiornamento dipendenze Python...
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: fastapi==0.104.1 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 1)) (0.104.1)
Requirement already satisfied: uvicorn==0.24.0 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 2)) (0.24.0)
Requirement already satisfied: pandas==2.1.3 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 3)) (2.1.3)
Requirement already satisfied: numpy==1.26.2 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 4)) (1.26.2)
Requirement already satisfied: scikit-learn==1.3.2 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 5)) (1.3.2)
Requirement already satisfied: psycopg2-binary==2.9.9 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 6)) (2.9.9)
Requirement already satisfied: python-dotenv==1.0.0 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 7)) (1.0.0)
Requirement already satisfied: pydantic==2.5.0 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 8)) (2.5.0)
Requirement already satisfied: httpx==0.25.1 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 9)) (0.25.1)
Requirement already satisfied: xgboost==2.0.3 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 10)) (2.0.3)
Requirement already satisfied: joblib==1.3.2 in /home/ids/.local/lib/python3.11/site-packages (from -r requirements.txt (line 11)) (1.3.2)
Requirement already satisfied: anyio<4.0.0,>=3.7.1 in /home/ids/.local/lib/python3.11/site-packages (from fastapi==0.104.1->-r requirements.txt (line 1)) (3.7.1)
Requirement already satisfied: starlette<0.28.0,>=0.27.0 in /home/ids/.local/lib/python3.11/site-packages (from fastapi==0.104.1->-r requirements.txt (line 1)) (0.27.0)
Requirement already satisfied: typing-extensions>=4.8.0 in /home/ids/.local/lib/python3.11/site-packages (from fastapi==0.104.1->-r requirements.txt (line 1)) (4.15.0)
Requirement already satisfied: click>=7.0 in /home/ids/.local/lib/python3.11/site-packages (from uvicorn==0.24.0->-r requirements.txt (line 2)) (8.3.1)
Requirement already satisfied: h11>=0.8 in /home/ids/.local/lib/python3.11/site-packages (from uvicorn==0.24.0->-r requirements.txt (line 2)) (0.16.0)
Requirement already satisfied: python-dateutil>=2.8.2 in /home/ids/.local/lib/python3.11/site-packages (from pandas==2.1.3->-r requirements.txt (line 3)) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in /home/ids/.local/lib/python3.11/site-packages (from pandas==2.1.3->-r requirements.txt (line 3)) (2025.2)
Requirement already satisfied: tzdata>=2022.1 in /home/ids/.local/lib/python3.11/site-packages (from pandas==2.1.3->-r requirements.txt (line 3)) (2025.2)
Requirement already satisfied: scipy>=1.5.0 in /home/ids/.local/lib/python3.11/site-packages (from scikit-learn==1.3.2->-r requirements.txt (line 5)) (1.16.3)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/ids/.local/lib/python3.11/site-packages (from scikit-learn==1.3.2->-r requirements.txt (line 5)) (3.6.0)
Requirement already satisfied: annotated-types>=0.4.0 in /home/ids/.local/lib/python3.11/site-packages (from pydantic==2.5.0->-r requirements.txt (line 8)) (0.7.0)
Requirement already satisfied: pydantic-core==2.14.1 in /home/ids/.local/lib/python3.11/site-packages (from pydantic==2.5.0->-r requirements.txt (line 8)) (2.14.1)
Requirement already satisfied: certifi in /home/ids/.local/lib/python3.11/site-packages (from httpx==0.25.1->-r requirements.txt (line 9)) (2025.11.12)
Requirement already satisfied: httpcore in /home/ids/.local/lib/python3.11/site-packages (from httpx==0.25.1->-r requirements.txt (line 9)) (1.0.9)
Requirement already satisfied: idna in /home/ids/.local/lib/python3.11/site-packages (from httpx==0.25.1->-r requirements.txt (line 9)) (3.11)
Requirement already satisfied: sniffio in /home/ids/.local/lib/python3.11/site-packages (from httpx==0.25.1->-r requirements.txt (line 9)) (1.3.1)
Requirement already satisfied: six>=1.5 in /home/ids/.local/lib/python3.11/site-packages (from python-dateutil>=2.8.2->pandas==2.1.3->-r requirements.txt (line 3)) (1.17.0)
✅ Dipendenze Python aggiornate

🗄  Aggiornamento schema database...
   Applicando migrazioni SQL...
🗄  Sistema Migrazioni Database (Versioned)
📋 Verifica sistema versioning...
psql:/opt/ids/database-schema/migrations/000_init_schema_version.sql:14: NOTICE:  relation "schema_version" already exists, skipping
✅ Sistema versioning attivo
📊 Versione database corrente: 9
✅ Database già aggiornato (nessuna migrazione da applicare)
   ✅ Migrazioni SQL applicate
   Sincronizzando schema Drizzle...

> rest-express@1.0.0 db:push
> drizzle-kit push

No config path provided, using default 'drizzle.config.ts'
Reading config file '/opt/ids/drizzle.config.ts'
Using 'pg' driver for database querying
[✓] Pulling schema from database...
[✓] Changes applied
✅ Schema database completamente sincronizzato

📡 Configurazione RSyslog (log MikroTik)...
   ✅ RSyslog già configurato

📋 Verifica servizio list-fetcher...
   ✅ Servizio ids-list-fetcher già installato

🔄 Restart servizi...
✅ Servizi riavviati

╔═══════════════════════════════════════════════╗
║   ✅ AGGIORNAMENTO COMPLETATO                 ║
╚═══════════════════════════════════════════════╝

📋 VERIFICA SISTEMA:
   • Log backend:  tail -f /var/log/ids/backend.log
   • Log frontend: tail -f /var/log/ids/frontend.log
   • API backend:  curl http://localhost:8000/health
   • Frontend:     curl http://localhost:5000

📊 STATO SERVIZI:
ids         1034  1.1  2.3 2939568 381944 ?      Ssl  12:18   0:09 /opt/ids/python_ml/venv/bin/python3 main.py
ids         1069 18.3  0.1  52452 26240 ?        Ss   12:18   2:40 /opt/ids/python_ml/venv/bin/python3 syslog_parser.py
root        2447  0.0  0.2 731344 32324 pts/0    Rl+  12:33   0:00 /usr/bin/node /usr/bin/npm run dev
