Closed Sen5ation closed 5 months ago
I would offer 3 different ways to achieve this:
Install it from the UI by using the Node-RED manage palette
Execute the installation within the docker container using:
docker-compose exec nodered bash
Then navigate to data directory and run:
npm install node-red-contrib-amazon-echo
Use an init container which will install the module before starting the Node-RED service.
version: '3'
services:
nodered:
image: "nodered/node-red:latest"
environment: {}
ports:
- "1880:1880"
volumes:
- type: bind
source: ./data
target: /data/
restart: unless-stopped
depends_on:
nodered-init:
condition: service_completed_successfully
nodered-init:
image: "nodered/node-red:latest"
volumes:
- type: bind
source: ./data
target: /data/
entrypoint:
- "/bin/sh"
- "-c"
- "cd /data && npm install node-red-contrib-amazon-echo"
Thanks for the fully automated option nr 3. Although the other options will achive the same result I highly prefer the option 3 as it is fully automatic . I do have some issues with this option however. I hope you can give me a hint to a solution.
This is my compose file:
services:
nodered:
image: "nodered/node-red:latest"
#environment: {}
user: "1004"
ports:
- 'LOCALIP:1180:1880'
volumes:
- type: bind
source: /docker/nodered/container_data/
target: /data/
restart: unless-stopped
depends_on:
nodered-init:
condition: service_completed_successfully
nodered-init:
image: "nodered/node-red:latest"
volumes:
- type: bind
source: /docker/nodered/container_data/
target: /data/
entrypoint:
- "/bin/sh"
- "-c"
- "cd /data && npm install node-red-contrib-amazon-echo"
running /usr/bin/docker-compose --verbose -p docker-nodered -f /docker/nodered/compose_files/compose.yml up --force-recreate
I get this error:
...
compose.cli.verbose_proxy.proxy_callable: docker attach <- ('a004fe4a07005c31d53fa585fa74e277b08f3a15fe22b3739b82b1225e485a77', stdout=True, stderr=True, stream=True)
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.cli.verbose_proxy.proxy_callable: docker attach -> <docker.types.daemon.CancellableStream object at 0x7f74338e4b90>
compose.cli.verbose_proxy.proxy_callable: docker disconnect_container_from_network <- ('a004fe4a07005c31d53fa585fa74e277b08f3a15fe22b3739b82b1225e485a77', 'docker-nodered_default')
compose.parallel.feed_queue: Pending: set()
compose.cli.verbose_proxy.proxy_callable: docker disconnect_container_from_network -> None
compose.cli.verbose_proxy.proxy_callable: docker connect_container_to_network <- ('a004fe4a07005c31d53fa585fa74e277b08f3a15fe22b3739b82b1225e485a77', 'docker-nodered_default', aliases=['a004fe4a0700', 'nodered-init'], ipv4_address=None, ipv6_address=None, links=[], link_local_ips=None)
compose.cli.verbose_proxy.proxy_callable: docker connect_container_to_network -> None
compose.cli.verbose_proxy.proxy_callable: docker start <- ('a004fe4a07005c31d53fa585fa74e277b08f3a15fe22b3739b82b1225e485a77')
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.parallel.feed_queue: Pending: set()
compose.cli.verbose_proxy.proxy_callable: docker start -> None
compose.cli.verbose_proxy.proxy_callable: docker remove_container <- ('174a68b0eea4badbf025cb8a78548e972d5b782a42cfc6ec1aed21e8fc67e49e')
compose.cli.verbose_proxy.proxy_callable: docker remove_container -> None
Recreating docker-nodered_nodered-init_1 ... done
compose.parallel.feed_queue: Pending: set()
compose.parallel.parallel_execute_iter: Finished processing: <Service: nodered-init>
compose.parallel.feed_queue: Pending: {<Service: nodered>}
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=docker-nodered', 'com.docker.compose.service=nodered-init', 'com.docker.compose.oneoff=False']})
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('a004fe4a07005c31d53fa585fa74e277b08f3a15fe22b3739b82b1225e485a77')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': 'docker-default',
'Args': ['-c', 'cd /data && npm install node-red-contrib-amazon-echo'],
'Config': {'AttachStderr': False,
'AttachStdin': False,
'AttachStdout': False,
'Cmd': None,
'Domainname': '',
'Entrypoint': ['/bin/sh',
'-c',
'cd /data && npm install '
...
compose.parallel.feed_queue: Service(s) upstream of <Service: nodered> did not completed successfully - not processing
compose.parallel.parallel_execute_iter: Failed: <Service: nodered>
compose.parallel.feed_queue: Pending: set()
ERROR: for nodered Container "a004fe4a0700" exited with code 2.
ERROR: compose.cli.main.exit_with_metrics: Encountered errors while bringing up the project.
Do I see it correctly that the "Args" looks fine: 'Args': ['-c', 'cd /data && npm install node-red-contrib-amazon-echo'],
But in the Entrypoint there is the "node-red-contrib-amazon-echo" missing?: 'Entrypoint': ['/bin/sh','-c','cd /data && npm install '
or is that cut by the docker engine/output?
I understand the logic what is done by the init container/service, but I do not know why it does not function :/
You can use the following steps to debug the nodered-init container, as it appears to have exited with code 2:
docker-compose down
docker-compose up
docker-compose logs nodered-init
thanks a lot :)
as long as the urls http://IP/api/description.xml and http://IP/description.xml are accessable though Port 80 and the nodered and the amazon echo are on the same network, it should do right?
Is there something special I need to take care of when I am switching the nodered installation from one host/IP to another? Other than deleting the devices in alexa? It should discover them, right?
That's correct. The Node-RED Docker container needs to use the host network for the SSDP discovery process to work correctly. Echo devices and the Docker host must be on the same broadcast domain, and Echo devices will try to access the hub on port 80
Hi,
I do have a node-red docker container. How can I install this in a docker container? I did not find a how to in the wiki or via Google. Have you guys any tips?
my docker-compose.yml looks like this: