alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.46k stars 209 forks source link

🐛 [epicgamesfree] A new docker volume is created every addon restart #1322

Closed elkarto closed 4 months ago

elkarto commented 5 months ago

Description

The addon creates and uses a docker volume for its operation. The volume is mounted to "/usr/app/config"

The problem is that every time the addon is restarted it creates a new volume, leaving the previous one unused (without deleting it).

My knowledge of docker is limited but I believe that this behavior is not expected.

Reproduction steps

1. List docker volumes using CLI or view the list using portainer.
2. There will be a volume in use for the addon epicgamesfree
3. Restart the addon
4. Refresh the volume list
5. Notice a new volume was created, leaving the previous volume "unused"

Addon Logs

Starting...
/etc/cont-init.d/00-banner.sh: executing

-----------------------------------------------------------
 Add-on: Epic Games Free
 Automatically login and redeem promotional free games from Epic Games Store
-----------------------------------------------------------
 Add-on version: debian-2024-03-17
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.1  (amd64 / qemux86-64)
 Home Assistant Core: 2024.3.3
 Home Assistant Supervisor: 2024.03.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums
-----------------------------------------------------------
 Provided by: https://github.com/alexbelgium/hassio-addons 
-----------------------------------------------------------
/etc/cont-init.d/00-global_var.sh: executing
/etc/cont-init.d/01-config_yaml.sh: executing
Setting permissions for the config.yaml directory

Load environment variables from /config/addons_config/epicgamesfree/config.yaml if existing
If accessing the file with filebrowser it should be mapped to /homeassistant/addons_config/epicgamesfree/config.yaml
---------------------------------------------------------
Wiki here on how to use : github.com/alexbelgium/hassio-addons/wiki/Add‐ons-feature-:-add-env-variables

... no env variables found, exiting
/etc/cont-init.d/01-custom_script.sh: executing
Execute /homeassistant/addons_config/epicgamesfree/epicgamesfree.sh if existing
Wiki here : github.com/alexbelgium/hassio-addons/wiki/Add-ons-feature-:-customisation
/etc/cont-init.d/20-folders.sh: executing
/etc/cont-init.d/99-run.sh: executing
[00:06:20] WARNING: The config.json file found in /config/addons_config/epicgamesfree will be used. Please customize according to https://github.com/claabs/epicgames-freegames-node#json-configuration and restart the add-on

[00:06:20] INFO: Starting the app

Starting the upstream container

Setting localtime: Europe/Madrid
Setting timezone: Europe/Madrid
Run on startup: true
[2024-03-27 00:06:22.989 +0100] INFO: Started epicgames-freegames-node
    COMMIT_SHA: "54c98a7c5e5d6b04d2be9f336a319be1b24c876d"
    BRANCH: "master"
    DISTRO: "alpine"
[2024-03-27 00:06:23.595 +0100] WARN: Version check API call failed
[2024-03-27 00:06:23.598 +0100] INFO: Checking free games for ****
    user: "****"
[2024-03-27 00:06:23.947 +0100] INFO: Dispatching notification
    user: "****"
    reason: "LOGIN"
    url: "****"

Architecture

amd64

OS

HAos, Virtual Machine

alexbelgium commented 5 months ago

Hi, please try to do ha su repair in terminal and it should remove all dangling volumes. It is alas inherent to the way the addons are set and I don't think it is possible to fully prevent it without a major refactoring. As such, I have an automation to periodically run ha su repair on my system

elkarto commented 5 months ago

Hi @alexbelgium

I tried a "ha su repair", the command completed successfully but the volumes were not deleted.

alexbelgium commented 5 months ago

Thanks for the feedback - you might try docker volume prune to remove all volumes unused (https://frameworks.readthedocs.io/en/latest/docker/pruneDocker.html)

A more aggressive alternative is docker prune -a that will delete all unused volumes, containers... This will also delete containers of addons stopped, so you would need an ha su repair to re-create them afterwards.

Alas I base my dockerfiles on pre-existing containers that already reference volumes - and there is no way to cancel their creation that I know of. So I would need to re-create the whole initial container which is much more cumbersome. Periodically running the commands (at 1am for example) should keep your system fit...

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.