3.3 KiB
Architecture and deployment
Clean architecture (Python monitor)
Under monitor/src/adn_monitor/:
- Domain — value objects, errors, opcode types.
- Application —
MonitorState,process_messageinmonitor_controller.py, alias service, Last Heard / TG count use cases, time formatting. - Infrastructure — YAML
load_config, Twisted TCP client (ReportClientFactory) to the peer server, WebSocket factory for the dashboard, MySQL repositories, pickle/json decoders forCONFIG_SND/BRIDGE_SND.
The monitor connects outbound to ADN_CONNECTION.ADN_IP:ADN_PORT and receives length-prefixed (netstring-style) messages. It updates in-memory CTABLE (masters/peers/OpenBridge) and BTABLE (bridges), and persists BRDG_EVENT outcomes when MySQL is configured.
Report protocol (from the peer server)
Same opcodes as documented for the server: CONFIG_SND, BRIDGE_SND, BRDG_EVENT, etc. The monitor decodes and applies them in process_message — see Monitoring and reports.
WebSocket
monitor.py runs a Twisted WebSocket on WEBSOCKET_SERVER.WEBSOCKET_PORT, pushing JSON snapshots at FREQUENCY so the React app updates without polling for core state.
PHP backend
- Slim 4 front controller:
backend/public/index.php. - Loads
adn-mon.yamlviaADN_CONFIG_PATH(same as monitor). /api/config/dashboard— title, language, feature flags (selfService,showConsole, …) fromDASHBOARD./api/auth/*— session cookie auth when SELF_SERVICE DB is available./api/self-service/*— device options (see Self-service)./api/aliases/*— optional proxy to TG/bridge list URLs from ALIASES.
Frontend
- Vite + React under
frontend/; build produces static assets served by nginx/Apache or similar. - Uses
API_BASE(build-time) to reach the PHP API and WebSocket URL for live data.
Hotspot proxy
- Entry:
proxy/proxy.py; packagesrc/adn_proxy/(domain / application / infrastructure). - Reads
PROXYandSELF_SERVICEfrom the same YAML. - For each hotspot client, allocates a port in
DESTPORT_START…DEST_PORT_ENDand forwards UDP toMASTER. - When self-service updates
Clients.optionsand setsmodified=1, the proxy sends RPTO to the master on a timer (~10 s). The peer server then applies options to the hotspot path (see Self-service).
Why it is not part of the peer server binary: it shares adn-mon.yaml, MySQL self-service, and deployment with the monitor stack — see Why it ships with the monitor.
Details: Hotspot proxy (config keys, peer server port range, startup).
Typical deployment topology
[Hotspots] --UDP--> [Proxy :LISTEN_PORT] --UDP--> [Peer server :DESTPORT range]
|
v
MySQL (Clients)
[Peer server :REPORT_PORT] <--- TCP --- [monitor.py : connects as client]
[Browser] --HTTPS--> [PHP API + static frontend]
[Browser] --WS----> [monitor WebSocket :9000]