Appdaemon on docker + RPI3

Hello everyone,

I’m struggling for a few hours with appdaemon on docker / RPI3
Docker is installed and is running ok.

1/ I git cloned the repo https://github.com/home-assistant/appdaemon on my RPI and changed the dockerfile with a
FROM resin/raspberrypi3-python:3.6.2

Original => https://github.com/home-assistant/appdaemon/blob/dev/Dockerfile

2/ Build the appdaemon image => OK

3/ Ran the following docker command :
`docker run --name=appdaemon -v /home/pi/appdaemon/conf:/conf -p 5050:5050 -e HA_URL=“http://192.168.1.105:8123” -e DASH_URL=“http://:5050$HOSTNAME” 76d1dca80fda``

and got the error :
`2017-08-28 20:58:10.712577 INFO AppDaemon Version 2.1.8 starting
2017-08-28 20:58:10.713105 INFO Configuration read from: /conf/appdaemon.yaml
2017-08-28 20:58:10.880104 INFO Starting Apps
2017-08-28 20:58:11.078243 INFO Got initial state
2017-08-28 20:58:11.079872 INFO Loading Module: /conf/apps/hello.py
2017-08-28 20:58:11.082100 INFO Loading Object hello_world using class HelloWorld from module hello
2017-08-28 20:58:11.356665 INFO hello_world: Hello from AppDaemon
2017-08-28 20:58:11.360537 INFO hello_world: You are now ready to run Apps!
2017-08-28 20:58:11.361014 INFO App initialization complete
2017-08-28 20:58:11.361945 INFO Starting dashboard
2017-08-28 20:58:11.372097 WARNING ------------------------------------------------------------
2017-08-28 20:58:11.372569 WARNING Unexpected error in dashboard thread
2017-08-28 20:58:11.372993 WARNING ------------------------------------------------------------
2017-08-28 20:58:11.376694 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_urldispatcher.py”, line 401, in init
raise ValueError(‘Not a directory’)
ValueError: Not a directory

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/src/app/appdaemon/rundash.py”, line 319, in run_dash
setup_routes(conf.dashboard_obj)
File “/usr/src/app/appdaemon/rundash.py”, line 288, in setup_routes
app.router.add_static(’/compiled_javascript’, dashboard.compiled_javascript_dir)
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_urldispatcher.py”, line 845, in add_static
follow_symlinks=follow_symlinks)
File “/usr/local/lib/python3.6/site-packages/aiohttp/web_urldispatcher.py”, line 404, in init
“No directory exists at ‘{}’”.format(directory)) from error
ValueError: No directory exists at ‘/conf/compiled/javascript’

2017-08-28 20:58:11.377177 WARNING ------------------------------------------------------------
2017-08-28 20:58:11.377612 INFO API is disabled
2017-08-28 20:58:11.406037 INFO Connected to Home Assistant 0.51.2``

Any help would be appreciated I don’t know why does this error pop up and how to solve it.
I read it’s maybe because of a perms issue but I logged in the container as root, tried to start appdaemon -c ./conf and same error.

Thank you very much.

I got around this by creating the directory and restarting the docker. It also complains that /conf/compiled/css doesn’t exist so create that too.

Yeah I did the same thing as a workaround and it works.
It’s definitely a permissions/ownership issue and UID between host and container as I understood.
I’ll dig that subject a little bit later

In case someone else finds this I had the same issues on Raspbian. I’m running this standalone (i.e. not on the same server as HASS) and had to manually create three directories, chown them and restart.

And similarly if using docker, I had to do the following:

  1. Start the docker container as described in http://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html
    It will complain about the missing directory

  2. shell into the running docker container as follows
    docker exec -i -t 94d2ca1a5782 /bin/bash

(where 94d2ca1a5782 was my container ID)

  1. Copy the conf tree from the container to your docker host:
    scp -r /conf somewhere:/mnt/data/containers/HomeAssistant/appdaemon/conf

  2. Stop the container with ctrl-C

  3. Create the directories under the conf tree on your docker host
    mkdir -p conf/compiled/javascript mkdir -p conf/compiled/css

  4. Start it again, adding the volume mount to your new conf tree

docker run --rm -it -p 5050:5050
-e HA_URL=“http://homeassistant.my.domain
-e HA_KEY=“XXXXX”
-e DASH_URL=“http://appdaemon.my.domain:5050
-v /mnt/data/containers/HomeAssistant/appdaemon/conf:/conf
acockburn/appdaemon:latest

Or if you want to run the container using its own IP address:

CONTAINER_SUBNET=“macvlan1”
CONTAINER_IPADDR=“192.168.0.81”
CONTAINER_DNS=“192.168.0.1”

docker run --rm -it
–net=${CONTAINER_SUBNET}
–ip=${CONTAINER_IPADDR}
–dns $CONTAINER_DNS
-e HA_URL=“http://homeassistant.my.domain
-e HA_KEY=“XXXXX”
-e DASH_URL=“http://appdaemon.my.domain:5050
-v /mnt/data/containers/HomeAssistant/appdaemon/conf:/conf
acockburn/appdaemon:latest

1 Like