Luligu / matterbridge

Matterbridge plugin manager for Matter
https://github.com/Luligu/matterbridge/blob/main/README.md
Apache License 2.0
125 stars 13 forks source link

Plugins break when docker compose recreates container #76

Closed Ultra-bob closed 2 weeks ago

Ultra-bob commented 2 weeks ago

When docker compose recreates my container (for example after editing the environment variables or command), the plugins break, seemingly because the node_modules folder was reset

  matterbridge:
    environment:
      HOME_ASSISTANT_URL: 'http://192.168.2.4:8123'
      HOME_ASSISTANT_ACCESS_TOKEN: "*********"
      HOME_ASSISTANT_CLIENT_CONFIG: |
        {
          "includeDomains": ["light", "fan"],
          "includePatterns": ["switch.sound_machine", "binary_sensor.*_door"]
        }
    container_name: matterbridge
    command: ["matterbridge", "-bridge", "-docker", "-mdnsinterface eno1"]
    image: luligu/matterbridge:latest # Matterbridge image with the latest tag
    network_mode: host # Ensures the Matter mdns works
    restart: always # Ensures the container always restarts automatically
    volumes:
      - "${HOME}/homeassistant/config/matterbridge/plugins:/root/Matterbridge" # Mounts the Matterbridge plugin directory
      - "${HOME}/homeassistant/config/matterbridge/storage:/root/.matterbridge" # Mounts the Matterbridge storage directory

Error logs:

[00:10:35.749] [Matterbridge] Matterbridge version 1.3.9 mode bridge restart mode docker running on Linux 6.1.0-21-amd64 linux x64 
[00:10:35.818] [Matterbridge] The frontend http server is listening on http://172.19.0.1:8283 
[00:10:35.819] [Matterbridge] The WebSocketServer is listening on ws://172.19.0.1:8283 
[00:10:35.826] [Matterbridge] Loading plugin matterbridge-home-assistant type DynamicPlatform 
[00:10:35.829] [Matterbridge] Failed to load plugin matterbridge-home-assistant: Error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/matterbridge-home-assistant/package.json' 
[00:10:36.376] [Matterbridge] The plugin matterbridge-home-assistant is up to date. Current version: 1.5.2, Latest version: 1.5.2 
[00:10:36.827] [Matterbridge] The plugin matterbridge-home-assistant is in error state. 
[00:10:36.827] [Matterbridge] The bridge will not start until the problem is solved to prevent the controllers from deleting all registered devices. 
[00:10:36.827] [Matterbridge] If you want to start the bridge disable the plugin in error state and restart. 
Ultra-bob commented 2 weeks ago

The only way I was able to work around it was to hit remove and then re-install it every time this happened

Luligu commented 2 weeks ago

Hi, the reason is simple:

Solutions:

P.S.: Is "-mdnsinterface eno1" working correctly ?

Luligu commented 2 weeks ago

The only way I was able to work around it was to hit remove and then re-install it every time this happened

Try to just install it, I didn't try but I guess it should work.

Ultra-bob commented 2 weeks ago

P.S.: Is "-mdnsinterface eno1" working correctly ?

It seems to work, no more errors

they ask me to add matterbridge-home-assistant in the matterbridge image;

I'll try using the matterbridge-home-assistant docker image instead of this one

Ultra-bob commented 2 weeks ago

That seems to solve my problem

Luligu commented 2 weeks ago

[1.3.10] - 2024-07-05

Added

Changed

Buy me a coffee

This solve the problem of reinstalling npm plugins after docker pull.