Architettura — Overview
Scopo
Descrivere lo stack, i confini dell'app ez_factoryos e i principi di integrazione di Ez FactoryOS (MES semplificato per Ortobellina / OP Raggio di Sole, lavorazione insalate IV gamma).
Stack
| Layer | Tecnologia | Note |
|---|---|---|
| Framework | Frappe v16 | App custom, senza ERPNext |
| Backend | Python 3.14 | DocType, API whitelist, RQ |
| Frontend | Frappe Desk (JS) | Workspace Ez FactoryOS |
| Database | MariaDB 11.8 | Persistenza DocType |
| Cache / queue | Redis 8.8 | Cache + RQ |
| Gateway OT | Node-RED + Mosquitto | Rete Docker privata |
| Dev / deploy | Docker Compose + Coolify | VPS Netcup |
| CI/CD | GitHub Actions → GHCR | Promozione digest staging→main |
| Docs | VitePress | docs.factoryos.ezbit.it |
Diagramma di contesto
mermaid
flowchart TB
subgraph client [Client]
Desk[Frappe Desk]
API[REST / RPC]
end
subgraph app [App ez_factoryos]
DocTypes[DocTypes]
NodeAPI[integrations/node_red]
Hooks[hooks / patches]
end
subgraph infra [Runtime]
MariaDB[(MariaDB)]
Redis[(Redis)]
end
subgraph ot [OT privata]
NR[Node-RED]
MQTT[Mosquitto]
Machines[Macchine / PLC]
end
Desk --> DocTypes
API --> DocTypes
Desk --> NodeAPI
NodeAPI --> NR
NR --> MQTT
NR --> Machines
DocTypes --> MariaDB
Hooks --> RedisPrincipi
| Principio | Implicazione |
|---|---|
| App autonoma | Solo ez_factoryos; no ERPNext |
| Parametrico | Config via DocType/env, no hardcoded di produzione |
| OT disaccoppiato | Nessun client Modbus/OPC UA in Frappe; solo HTTP verso Node-RED |
| Audit comandi | Ogni comando macchina passa da Machine Command + log |
| Ambienti isolati | DB, Redis, volumi, domini e token per dev / staging / main |
| Secret fuori repo | Solo .env, Coolify, GitHub Environments |
Ambienti e domini
| Ambiente | Branch | Dominio |
|---|---|---|
| Locale | — | http://localhost:8001 (factory.local) |
| Staging | staging | https://staging-factoryos.ezbit.it |
| Production | main | https://factoryos.ezbit.it |
| Docs | path docs/ | https://docs.factoryos.ezbit.it |
| Pannello control | dev (servizio ez-factoryos-control) | https://control.factoryos.ezbit.it |
Moduli presenti nel codice
| Area | Contenuto |
|---|---|
| Anagrafiche + Workspace + Number Card | Customer, Supplier, Product + distinta (materie/packaging/etichette), Category, Label, Raw Material, Packaging, Line + macchine, Machine, Operator, Shift |
| Factory Work Order | Ordine di lavoro con cliente, prodotto, linea, quantità, stato manuale, campo external_id (Business Cube ID) compilabile a mano |
| Macchine + Node-RED | Factory Machine, Machine Connection Profile, Machine Command con approvazione, Machine Event, Machine Data Log; adapter MQTT/Modbus/OPC UA sul gateway |
| Dashboard workspace | Entity Cards (get_entity_cards), 5 Number Card, 4 card di navigazione |
Tracciabilità lotti, controlli qualità formalizzati e giacenze di magazzino si gestiscono oggi con gli strumenti esistenti: distinta base su Factory Product, note su Work Order, Machine Event / Machine Data Log, filtri ed export CSV delle List View. Vedi le guide in Uso operativo.
