Architecture of External Integrations in Gladys Assistant
masterExternal integrations in Gladys Assistant run as isolated Docker containers within a dedicated bridge network (gladys-integrations). The system uses a Supervisor (server/lib/external-integration/) to manage the lifecycle of these containers (States: Installée → Démarrage → En fonctionnement → Dégradée → En panne → Arrêtée).
Key architectural components:
- Host API (REST): Accessible via
/api/integration/v1/*, used by integrations to interact with the core (e.g.,saveState,gladys.variable). - WebSockets (WS): An extension of the
WebsocketManagerused for real-time communication (commands, scan requests, device notifications, and lifecycle pings/pongs). - Data Model: An external integration is treated as a service in the database (a row in
t_servicewithtype: 'external') to avoid identity synchronization issues. - Security: Integrations use stateless JWT authentication (not linked to a user) which is regenerated upon container recreation. They are sandboxed via Docker and have no access to the Docker socket.