homeassistant-addons icon indicating copy to clipboard operation
homeassistant-addons copied to clipboard

Backups contain large image.tar files // adsb feeder docker image in backup

Open bernikr opened this issue 3 years ago • 5 comments

I recently installed the adsb feeder addon and noticed that it significantly inflates the size of my home assistant backups. Before the backups were around 3MB and afterwards over 300MB. Most of that seems to come from the image.tar file inside the adsb feeder addon. For other addons this file doesn't seem to be included in the backup, only the config files.

For now i just excluded the addon from my daily backups, but it would be great if this wasnt necessary.

bernikr avatar Dec 16 '21 23:12 bernikr

Sadly, this is true.

Add-ons that don't provide pre-build images, like the adsb feeder one, fill the backup file. This is something that bugs me a while, but besides pre-building all images, I did not find any solution to this.

pre-building all images/addo-ons is quite some work. That can be made easy by spending a lot of work on good GitHub actions that automate everything. This leads back to the good old question:

Never spend 6 minutes doing something by hand when you can spend 6 hours failing to automate it

So I guess there are only 2 possible solutions for this:

  • provide pre-build images, which was some kind of pain iirc
  • find some solution to exclude these images from backups, which is currently uknown to me

Need to think about this...

MaxWinterstein avatar Dec 17 '21 00:12 MaxWinterstein

Also adding a ref to https://github.com/home-assistant/supervisor/issues/3414

This might be tackled down one day... hopefully...

MaxWinterstein avatar Apr 02 '22 17:04 MaxWinterstein

provide pre-build images, which was some kind of pain iirc

Hi, actually auto building addons is quite easy :) I can help you if you want to implement it. However, as you noted above, we can only implement it for new addons due to the supervisor bug... And they don't seem to be interested in solving it

alexbelgium avatar Apr 12 '22 20:04 alexbelgium

I am still interested in this.

I love how you don't give up on poking at the supervisor issue, even if they don't seem to be interested in fixing it...

Afair the only way for this would be to pin a thick warning on top of the release notes and the addon has to be reinstalled completly for everyone, right?

(note for later me: https://github.com/MaxWinterstein/homeassistant-addons/blob/main/eufy-ha-mqtt-bridge/README.md)

MaxWinterstein avatar Aug 14 '22 09:08 MaxWinterstein

That would be a good idea, however if the data is stored in /data then everything would be lost when people uninstall and reinstall... And if they have an automatic update set up then they could not read the update notes and miss this step... I'm still hopeful that they would solve the issue as I can't understand why they would voluntarily leave a bug in their system!

alexbelgium avatar Aug 14 '22 10:08 alexbelgium

A fix was made and will be merged soon

alexbelgium avatar Oct 25 '22 22:10 alexbelgium

A fix was made and will be merged soon

oh nice! Thanks for the hint!

We will see when https://github.com/home-assistant/supervisor/pull/3971 gets merged and released.

Maybe I am then in the mood to overhaul all those image things 🤔

MaxWinterstein avatar Oct 28 '22 20:10 MaxWinterstein

The feature was released with supervisor 2022.11.0, Nov 14th, see https://github.com/home-assistant/supervisor/releases/tag/2022.11.0

@alexbelgium Is there something to read out there, how do you handle all this? I am missing some flow on how to create, test and deploy upgrades :(

MaxWinterstein avatar Nov 25 '22 20:11 MaxWinterstein

Well, now you need to create a workflow such as this one : https://github.com/alexbelgium/hassio-addons/blob/master/.github/workflows/onpush_builder.yaml that looks at this list of file to build : https://github.com/alexbelgium/hassio-addons/blob/master/.github/paths-filter.yml, then add the image tag to your config.json https://github.com/alexbelgium/hassio-addons/blob/510e02f89443c70dd576384e364dffec2c52b517/addons_updater/config.json#L13

In theory, if you have your worflow and path-filter set it will run the github action when you will modify the config.json! If the build is successful, last step is to make the github package public instead of private

Hope this makes sense, it was lots of trial and errors for me ;)

alexbelgium avatar Nov 25 '22 21:11 alexbelgium

I finally found a few minutes to work on this 🎉

With the new release 1.18.0 this might no longer be an issue, woohoo!

For me it looks promising, output of supervisor logs:

22-11-25 22:31:20 INFO (SyncWorker_5) [supervisor.docker.addon] Updating image f1c878cb/aarch64-addon-adsb-multi-portal-feeder:1.17.0 to maxwinterstein/adsb-multi-portal-feeder-aarch64:1.18.0
22-11-25 22:31:20 INFO (SyncWorker_5) [supervisor.docker.interface] Downloading docker image maxwinterstein/adsb-multi-portal-feeder-aarch64 with tag 1.18.0.
22-11-25 22:31:21 INFO (MainThread) [supervisor.addons] Add-on 'f1c878cb_adsb-multi-portal-feeder' successfully updated
22-11-25 22:31:22 INFO (SyncWorker_2) [supervisor.docker.interface] Cleanup images: ['f1c878cb/aarch64-addon-adsb-multi-portal-feeder:1.17.0']

It changes successfully to the prebuilt image and even removed the old local one.

The backup now just contains some small, more or less useless stuff. It was just a few KB for me.

I just hope this does work cross arch 🤞

:warning: Note: This needs a recent version of the Supervisor, update if needed!


@alexbelgium this is smart! So when developing locally you just remove the image key from the config?

MaxWinterstein avatar Nov 25 '22 21:11 MaxWinterstein

@bernikr even though this is a few days old, might volunteer to verify this works as desired?

MaxWinterstein avatar Nov 25 '22 21:11 MaxWinterstein

Exact! Just remove the image tag and you can tweak it and rebuild using the same version so no one notices :)

alexbelgium avatar Nov 25 '22 21:11 alexbelgium

Congrats for the fast implementation of the build system!

alexbelgium avatar Nov 25 '22 21:11 alexbelgium

Congrats for the fast implementation of the build system!

I guess you looked at the old stuff, I just started yesterday on a private fork ;) I stole the most of your code, and it works awesome - at least for PRs now. But more when there is more time available...

I tried to get things going for the ADSB feeder image. It's pretty similar to your zoneminder addon. I don't start with a HA base image, I just enhance an existing one.

What confuses me, is the multi arch build part. I remember that at one point when I was trying this a while ago, I ended up with images that contained the wrong arch. They were not able to start at all.

Looking at your zoneminder build logs, it seems like every arch pulls the same base image, which shouldn't work. But somehow it does.

https://github.com/alexbelgium/hassio-addons/actions/runs/3556978326/jobs/5974703912#step:6:214

https://github.com/alexbelgium/hassio-addons/actions/runs/3556978326/jobs/5974703942#step:6:213

https://github.com/alexbelgium/hassio-addons/actions/runs/3556978326/jobs/5974703972#step:6:216

All three above are different arch, but seem to pull the same base image, at least the same SHA.

Is this working fine for you?

Setting up different machines with different arches to test is quite a job...

MaxWinterstein avatar Nov 28 '22 09:11 MaxWinterstein

Actually it pulls a multi-arch image but builds correctly thanks to the "-platform" argument

alexbelgium avatar Nov 28 '22 09:11 alexbelgium

I can confirm that the issue is fixed now. Thank you!

bernikr avatar Dec 01 '22 09:12 bernikr