t0bst4r / home-assistant-matter-hub

Publish your Home-Assistant Instance using Matter.
Apache License 2.0
146 stars 8 forks source link

Docker image does not start, exit code 1 without logs output #172

Closed mwhrtin closed 1 day ago

mwhrtin commented 2 days ago

I'm not sure what I'm doing wrong, since the Docker image seems to be working for everyone else. When I start the matter hub using the Docker image, it exits after a couple of seconds with exit code 1, and nothing else is logged.

I've tried both the latest version and a few earlier ones, but the result is the same. It doesn't matter whether I start the container using Docker Compose or Docker directly.

matterhub:
  image: ghcr.io/t0bst4r/home-assistant-matter-hub:latest
  container_name: matterhub
  environment:
    - HAMH_HOME_ASSISTANT_ACCESS_TOKEN="REDACTED"
    - HAMH_HOME_ASSISTANT_URL=http://X.X.X.X:XXXX/
    - HAHM_LOG_LEVEL="debug"
    - HAMH_WEB_PORT= 8482
  volumes:
    - /docker/volumes/matterhub/data:/data
  network_mode: host
  restart: "no"

This is the full log:

[ 2024-11-19T15:17:32.648Z ] [ INFO  ] [ Storage                                            ]: Storage location: /data
home-assistant-matter-hub start

start the application

Options:
  --help                         Show help                             [boolean]
  --config                       Provide the path to a configuration JSON file,
                                 which can include all the other command options
                                 . You can use kebabcase ("log-level") or camelc
                                 ase ("logLevel").
  --log-level
  [string] [choices: "silly", "debug", "info", "warn", "error"] [default: "info"
                                                                               ]
  --disable-log-colors                                [boolean] [default: false]
  --storage-location             Path to a directory where the application shoul
                                 d store its data. Defaults to $HOME/.home-assis
                                 tant-matter-hub                        [string]
  --web-port                     Port used by the web application
                                                        [number] [default: 8482]
  --mdns-network-interface       Limit MDNS to this network interface   [string]
  --home-assistant-url           The HTTP-URL of your Home Assistant URL
                                                             [string] [required]
  --home-assistant-access-token  A long-lived access token for your Home Assista
                                 nt Instance                 [string] [required]

1

If I omit the Home Assistant URL variable or provide an invalid URL, it will throw a syntax error and print a stack trace in the log. But when I pass all the required variables it will just exit with a 1.

t0bst4r commented 2 days ago

I need to improve this error log, but it indicates that the app could not connect to home assistant.

Please verify if home assistant can be reached from the container.

mwhrtin commented 2 days ago

Thank you! The issue was that I couldn’t authenticate from the container.

I was able to ping Home Assistant from the container, but accessing GET /api/ resulted in a 403 Forbidden error. The access token was correct, and I could verify this by authenticating from another machine, but it still failed from the container.

It turns out that the IP address of the container had been added to Home Assistant's IP ban list. What complicated things was that I had already cleared the ip_bans.yaml file, so it was empty, but I had never restarted the Home Assistant core after clearing it.

Once I restarted Home Assistant, the container could authenticate, and the Matter Hub launched successfully.