feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Prebuild images on container creation for faster "Update all" operation

Open sefininio opened this issue 3 years ago • 5 comments

Describe the problem you have/What new integration you would like

Currently, Update all takes a huge amount of time, since images are built at the moment, each taking a few minutes and for systems with many devices this mounts up to a very long time.

Suggestion: On ESPHome upgrade or container create - pre-build all device images in the background, so they are ready to upload to the device. Then when the user clicks "Update all" it is simply a matter of the actual upload to device which takes much less time.

Please describe your use case for this integration and alternatives you've tried:

User clicks "Update all" and then ESPHome starts building images one by one, user has to wait a long time to know if the process was successful or not for each device.

Additional context

sefininio avatar Feb 19 '22 07:02 sefininio

+additional benefit as an extra side feature extra to this, one could save a "snapshot" of all the binaries by downloading them in one package and save them on the local machine for future backup/revert to previous state if something goes wrong with the new release. https://github.com/esphome/feature-requests/issues/1423

nagyrobi avatar Feb 19 '22 12:02 nagyrobi

This could be a good first issue or part of WTH or hacktoberfest? I could pick a stab at it, with some directions

sefininio avatar Oct 08 '22 05:10 sefininio

Go ahead!

nagyrobi avatar Oct 08 '22 05:10 nagyrobi

@nagyrobi So what I am thinking is:

  • Create a new websocket command EsphomeCreateAllUpdatesHandler that will create the bin files and store them in the config directory
  • Modify EsphomeUpdateAllHandler to first check for their existence before creating them and if they exist, just move on to flashing them.
  • Each system reload, check bin version against the current version and if required, run the CreateAllUpdatesHandler again
  1. Does that make sense to you?
  2. I could not find the actual logic that runs when a handler is invoked, is it in __main__.py?

sefininio avatar Oct 08 '22 06:10 sefininio

  • I'd suggest a separate subdirectory for the bins (don't mix with config yamls)
  • About checking their existence, I'd suggest to always overwrite them when going through this new route manually.
  • Have immediate flashing optional. Say, you'd just want to build all the bins for putting aside without mass flashing.

nagyrobi avatar Oct 08 '22 08:10 nagyrobi