hassio-addons / addon-appdaemon

AppDaemon4 - Home Assistant Community Add-ons
https://addons.community
MIT License
151 stars 47 forks source link

Internet is required when system / python packages are set #212

Closed snjoetw closed 1 year ago

snjoetw commented 1 year ago

Problem/Motivation

Yesterday we had a power outage and around the same time our ISP was also having issue. So when the power was restored, we still didn't have internet.

I was expecting Home Assistant and all my automations in AppDaemon (running with this add-on) to resume when the power is restored as most of my IoT devices are local controlled.

Home Assistant did come back up but not Appdaemon add-on due to the following error:

cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
cont-init: info: running /etc/cont-init.d/appdaemon.sh
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.16/main: network error (check Internet connection and firewall)
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/main: No such file or directory
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
ERROR: https://dl-cdn.alpinelinux.org/alpine/v3.16/community: network error (check Internet connection and firewall)
2 errors; 49 distinct packages available
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.16/community: No such file or directory
[07:05:05] FATAL: Failed updating Alpine packages repository indexes
cont-init: info: /etc/cont-init.d/appdaemon.sh exited 1
cont-init: warning: some scripts exited nonzero
s6-rc: warning: unable to start service legacy-cont-init: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
prog: fatal: stopping the container.
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

As you can see, it tried to fetch and download the system packages but couldn't and exited in the end.

Is it possible to add a flag to the add-on config so that if it's having problem downloading system / python packages then just skip it and continue to let appdaemon to run?

For my use cause, system/python packages are only used by a small subset of my automations. So having those small subset of automations to fail instead of blocking everything makes more sense.

Expected behavior

When internet is down, restarting AppDaemon should continue to work

Actual behavior

AppDaemon tried to fetch system / python packages and exited in the end due to internet being down.

Steps to reproduce

  1. Run AppDaemon add-on with system / python packages
  2. Block internet access for AppDaemon add-on
  3. Restart AppDaemon

Proposed changes

Add a flag to the add-on config so that if it's having problem downloading system / python packages then just skip it and continue to let appdaemon to run?

This is useful if system/python packages are only used by a small subset of my automations. Without those packages, only the automations that need them will fail, all other automations should continue to work.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

snjoetw commented 1 year ago

bump

frenck commented 1 year ago

When internet is down, restarting AppDaemon should continue to work

The add-on does that, unless you customize it as you did. You added extra (external) packages.

From an add-on perspective, there is not much I can do.

Is it possible to add a flag to the add-on config so that if it's having problem downloading system / python packages then just skip it and continue to let appdaemon to run?

You can do that if you like. Use the init commands to run any command you like, including manually installing packages and allowing them to fail.

https://github.com/hassio-addons/addon-appdaemon/blob/main/appdaemon/DOCS.md#option-init_commands

Some examples:

- "apk update || true"
- "apk add ffmpeg || true"
- "pip install non-existing-package || true"