Docker and appdaemon

I’m going crazy here.

I’ve had Appdaemon and HADasboard running on an RPi3B with hass in venv, but now on a machine running Ubuntu and docker, I can’t get it working. I’ve seen plenty of threads about docker+appdaemon, but none of them had the answer (this one was close, though).

My appdaemon.yaml (located in /home/aephir/docker/homeassistant/):

secrets: /home/aephir/docker/homeassistant/secrets.yaml
log:
  accessfile: /home/aephir/docker/appdaemon/access.log
  errorfile: /home/aephir/docker/appdaemon/error.log
  logfile: /home/aephir/docker/appdaemon/appdaemon.log
  log_generations: 3
  log_size: 1000000
appdaemon:
  logfile: STDOUT
  errorfile: STDERR
  threads: 10
  api_port: 5000
  app_dir: /home/aephir/homeassistant/docker/homsassistant/appdaemon
  api_key: !secret appdaemon_api_key
  plugins:
    HASS:
      type: hass
      ha_url: "http://192.168.0.100:8123"
      ha_key: !secret api_password
      namespace: default
hadashboard:
  dashboard_dir: /home/aephir/docker/homeassistant/appdaemon/dashboards
  dash_url: "http://192.168.0.100:5050"

I’m running docker.compose, but for testing I’ve tried with

docker run --rm -it -p 5050:5050 \
-e HA_URL="192.168.0.100:8123" \  
-e HA_KEY="MY_SECRET_KEY" \  
-e DASH_URL="http://192.168.0.100:5050" \  
-v /home/aephir/docker/homeassistant:/conf \  
acockburn/appdaemon:latest

But running this, I get the error:

ERROR Error loading secrets file: /home/aephir/docker/appdaemon/secrets.yaml

secrets.yaml has permissions 777 (and is owned by aephir:docker). If I simply remove the secrets: section in appdaemon.yaml, I instead get an error that:

Traceback (most recent call last):
  File "/usr/local/bin/appdaemon", line 11, in <module>
    load_entry_point('appdaemon==3.0.1', 'console_scripts', 'appdaemon')()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 375, in main
    admain.main()
  File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 287, in main
    fh = RotatingFileHandler(logfile, maxBytes=log_size, backupCount=log_generations)
  File "/usr/local/lib/python3.6/logging/handlers.py", line 150, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/lib/python3.6/logging/handlers.py", line 57, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/local/lib/python3.6/logging/__init__.py", line 1030, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/local/lib/python3.6/logging/__init__.py", line 1059, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/home/aephir/docker/appdaemon/appdaemon.log'

creating the empty file with 777 permissions doesn’t help, and the ~/aephir/docker/appdaemon folder has 777 permissions.

I must be missing something, but I can’t seem to see it :confused:

Are you familiar with docker?

You are mapping /home/aephir/docker/homeassistant to a folder called /conf.

Inside the docker container, it can’t see /home/aephir/docker/homeassistant. It would see /conf.

In your appdaemon.yml file, replace /home/aephir/docker/homeassistant with /conf

2 Likes

Ahhhh, that makes sense. A lot more so after a good nights sleep. (Yes, I am quite new to docker, as you might have guessed)… Thanks!