5.4 KiB
5.4 KiB
S3-to-Local Sync Dashboard - Multi-Sync Support
🎉 Nuove Funzionalità (18 Marzo 2026)
1. Non invia le notifiche Gotify ✅ RISOLTO
- Problema: La funzione
gotify_send()aveva un'escaping JSON incorretto - Soluzione:
- Aggiunto
jqal Dockerfile per proper JSON encoding - Riscritto
gotify_send()insync.shcon corretto escaping dei caratteri speciali - Aggiunta proper gestione degli errori con fallback a sed
- Aggiunto
2. Multiple Associazioni Sync (1:1 Bucket:Cartella) ✅ IMPLEMENTATO
- Ora supporta multiple sync simultanee
- Ogni sync ha:
- Identificatore univoco (
sync1,sync2, etc.) - Bucket S3 dedicato
- Cartella locale dedicata
- Directory di stato separata (
/data/state/sync1,/data/state/sync2)
- Identificatore univoco (
Configurazione in .env:
SYNC_CONFIGS='[
{"id": "sync1", "bucket": "backup-docs", "path": "/data/local1", "interval": 300},
{"id": "sync2", "bucket": "media-files", "path": "/data/local2", "interval": 600}
]'
3. Interfaccia Dashboard Ridisegnata ✅ IMPLEMENTATO
Tab Selector Dinamici
- Mostra un tab per ogni sync configurata
- Click per switchare tra sync
- Visualizza log e modifiche della sync selezionata
Grafica Responsiva e Dinamica
- CSS Flexbox + Grid: si adatta perfettamente al ridimensionamento della finestra
- Breakpoint Mobile: su schermi < 1200px, log e modifiche si impilano verticalmente
- Performance: auto-scroll, limite di 500 righe log, lazy loading
Organizzazione Pannelli
PRIMA:
Stats Cards (4)
↓
Config
↓
Log Panel (sx) | Modifiche Recenti (dx)
↓
Storico
ADESSO:
Stats Cards (4)
↓
Config
↓
[TAB SELECTOR] sync1 | sync2 | sync3
↓
Log (sopra) | Modifiche Recenti (destra)
↓
Storico
4. Visualizzazione Per-Sync ✅ IMPLEMENTATO
Ogni sync mostra i suoi dati indipendenti:
- Status badge (Avvio, Sincronizzazione, Sincronizzato, Errore)
- Statistiche cartella locale
- Log in tempo reale (SSE stream dedicato)
- Modifiche recenti
- Storico sincronizzazioni
🚀 Come Usare
Modalità Singola (Default - Compatibile)
# Nel .env, configure il bucket singolo
S3_BUCKET=my-bucket
# NON mettere SYNC_CONFIGS
# Avvio
docker-compose up -d
# La dashboard mostra una singola sync (nessun tab)
Modalità Multi-Sync
# Nel .env:
SYNC_CONFIGS='[
{"id": "sync1", "bucket": "bucket-a"},
{"id": "sync2", "bucket": "bucket-b"},
{"id": "sync3", "bucket": "bucket-c"}
]'
# Nel docker-compose.yml, aggiungi i volumi per ogni sync:
volumes:
- ./data/sync1:/data/local
- ./data/sync2:/data/local2
- ./data/sync3:/data/local3
- sync-state:/data/state
Poi:
docker-compose up -d
La dashboard automaticamente:
- Mostra tab per ogni sync
- Lancia multiple istanze di
sync.sh(una per bucket) - Visualizza log + modifiche per sync selezionata
📊 Struttura Nuova
API Endpoints
| Endpoint | Descrizione |
|---|---|
/api/syncs |
Lista di tutte le sync configurate |
/api/status/<sync_id> |
Stato di una specifica sync |
/api/stream/<sync_id> |
SSE stream log in tempo reale |
/api/changes/<sync_id> |
Modifiche recenti per una sync |
/api/history/<sync_id> |
Storico sincronizzazioni |
Directory di Stato
/data/state/
├── sync1/
│ ├── sync.log
│ ├── status.json
│ ├── history.json
│ └── recent_changes.json
├── sync2/
│ ├── sync.log
│ ├── status.json
│ ├── history.json
│ └── recent_changes.json
└── ...
🔧 Note Tecniche
entrypoint.sh
- Singola sync: Avvia 1 istanza di
sync.sh(come prima) - Multi-sync: Parsa JSON di
SYNC_CONFIGS, crea directory di stato, lancia N istanze disync.shconSTATE_DIRdiversi
sync.sh
- Accetta
STATE_DIRcome variabile d'ambiente - Scrive log/status/modifiche nella directory assegnata
gotify_send()ora ha proper JSON escaping
app.py
- Carica configurazione da
SYNC_CONFIGS - Fallback a singola sync se
SYNC_CONFIGSnon è definito - Routes parametriche con
<sync_id>
index.html
- CSS Grid + Flexbox per responsive design
switchSync(id)per cambiare tab- Mantiene stato separato per ogni sync
- Auto-update ogni 5-10-15s
✅ Checklist Implementazione
- Notifiche Gotify - Fixed JSON escaping + jq
- Multiple sync - Parsing SYNC_CONFIGS + multiple STATE_DIR
- UI multi-tab - Switch dinamico tra sync
- CSS responsivo - Flexbox/Grid con breakpoints
- Log/Modifiche orizzontali - Layout a due colonne
- Per-sync data - API routes con sync_id
- Docker multi-sync - entrypoint con Python JSON parser
- Compatibilità backward - Fallback a singola sync
🐛 Bug Risolti
-
Notifiche Gotify non inviate
- Causa: Escaping JSON non corretto in
printf - Fix: Uso di
jqcon proper escaping
- Causa: Escaping JSON non corretto in
-
Grafica non responsiva
- Causa: CSS max-width fisso, layout non flexible
- Fix: CSS Grid/Flexbox con responsive breakpoints
📝 Prossimi Miglioramenti Suggeriti
- API per aggiungere/rimuovere sync dinamicamente
- Statistiche aggregate di tutte le sync
- Throttling bandwidth globale (non per-sync)
- Health check per ogni sync
- Export dati sincronizzazioni in CSV
- Webhooks per sync completate
Version: 2.0.0 (Multi-Sync)
Last Updated: 18 Marzo 2026