Uninstalled external integrations: automatic cleanup?

Hello to (all and) everyone,

I have tested several external integrations, some are useful and remain installed, for others, they have been uninstalled. I was just wondering the following: what happens to the data that was attached to them? Are they deleted in the same way as the container that makes them available for the integration? Example: the Zigbee state tracking integration creates many « monitor » devices, do they remain somewhere?

Looking forward to your reply,

Have a nice end of the day,

Jean

Hello Jean,

Great question, and the answer is clear: uninstallation leaves nothing behind. There is no « automatic cleanup » to do later, because everything is removed at the exact moment of uninstallation.

Concretely, when you uninstall an external integration, Gladys deletes in order (externalIntegration.uninstall.js):

  • the main container of the integration,
  • its potential sub-containers (a Mosquitto broker, a Frigate…) and their private Docker network,
  • the data folder on the disk (/external-integrations/<selector>, which contains the /data of the container and the volumes of the sub-containers),
  • all devices created by the integration, and with them their features and the entirety of their state history (including in DuckDB),
  • its configuration variables,
  • its service line in the database,
  • and finally the Docker images that had been downloaded for it, except those still shared with another installed integration.

So for your specific example: the « monitor » devices created by the Zigbee state tracking integration disappear with it, history included. There is not even an option « keep the devices »: in the data model, a device necessarily belongs to a service (t_device.service_id is a non-null foreign key), so an orphaned device simply does not exist. If you reinstall the integration later, you get all your devices back via discovery, but the history, it does not return.

There is indeed an additional automatic cleanup, but it only concerns Docker images, not your data: a daily pass at 3:30 a.m. sweeps away unused images. It is deliberately very targeted, as it only takes images with the label io.gladysassistant.manifest, i.e., those built as Gladys integrations. No blind docker image prune -a: Gladys often shares its Docker daemon with the other containers in the house, it is not a question of touching it. This pass is mainly used to recover space on already cluttered installations (images left by previous updates, or by an integration removed from the store). On a recent installation, the targeted deletion during uninstallation is already sufficient.

Have a great end of the day too,

Thanks @pierre-gilles for this once again relevant answer that leaves no doubt about the maturity of Gladys, bravo to all the developers :heart: