Node-RED integration to launch a container with one click

Isn’t 1880 the default port for Node-RED?

hello @cce66
To avoid conflicts with an already installed Node-RED, @Lokkye moved it to port 1881, that’s what I read :wink:

In that case download

And check the port to which Node-RED is connected (you need to put your machine’s IP on the left and the port range to search in the blue area
![image|690x417](upload://d8DgCjo7oKrd8JmbFcZZqpDUVLG

It’s indeed port 1881 to avoid causing a conflict with an existing Node-RED installation.

image

@Psoy maybe the logs could help
Also check with Docker whether the container is running without errors.

[quote=« _Will_71, post:64, topic:6584 »]
Also check with Docker

Here are the logs

`
2023-09-14T22:03:29+0200 <info> scene.dailyUpdate.js:58 () Sunrise today is at 1:11 today, in your timezone = Europe/Paris
2023-09-14T22:03:29+0200 <info> scene.dailyUpdate.js:59 () Sunset today is at 13:23 today, in your timezone = Europe/Paris
2023-09-14T22:03:29+0200 <info> scene.dailyUpdate.js:70 () The sun rose this morning. Not scheduling for today.
2023-09-14T22:03:29+0200 <info> scene.dailyUpdate.js:84 () The sun has already set. Not scheduling for today.
2023-09-14T22:03:38+0200 <info> checkForContainerUpdates.js:13 (NodeRedManager.checkForContainerUpdates) Node-RED: Checking for current installed versions and required updates...
2023-09-14T22:03:38+0200 <info> checkForContainerUpdates.js:17 (NodeRedManager.checkForContainerUpdates) Node-RED: update #2 of the container required...
2023-09-14T22:03:38+0200 <info> checkForContainerUpdates.js:34 (NodeRedManager.checkForContainerUpdates) Node-RED: update #2 of the container done
2023-09-14T22:03:38+0200 <info> installContainer.js:44 (NodeRedManager.installContainer) Nodered: is being installed as Docker container...
2023-09-14T22:03:38+0200 <info> installContainer.js:45 (NodeRedManager.installContainer) Pulling nodered/node-red:3.1 image...
2023-09-14T22:04:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:04:00 GMT
2023-09-14T22:05:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:05:00 GMT
2023-09-14T22:06:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:06:00 GMT
2023-09-14T22:07:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:07:00 GMT
2023-09-14T22:08:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:08:00 GMT
2023-09-14T22:08:57+0200 <info> installContainer.js:49 (NodeRedManager.installContainer) Nodered: Preparing environment...
2023-09-14T22:08:57+0200 <info> configureContainer.js:16 (NodeRedManager.configureContainer) Node-RED: Docker container is being configured...
2023-09-14T22:08:57+0200 <info> configureContainer.js:36 (NodeRedManager.configureContainer) Node-RED: Writing default configuration...
2023-09-14T22:08:57+0200 <info> installContainer.js:52 (NodeRedManager.installContainer) Creation of container...
2023-09-14T22:09:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:09:00 GMT
2023-09-14T22:09:11+0200 <info> installContainer.js:57 (NodeRedManager.installContainer) Node-RED: successfully installed and configured as Docker container
2023-09-14T22:09:11+0200 <info> configureContainer.js:16 (NodeRedManager.configureContainer) Node-RED: Docker container is being configured...
2023-09-14T22:09:11+0200 <info> configureContainer.js:34 (NodeRedManager.configureContainer) Node-RED:  configuration file already exists.
2023-09-14T22:09:12+0200 <info> installContainer.js:80 (NodeRedManager.installContainer) Node-RED: container is (re)starting...
2023-09-14T22:09:23+0200 <info> installContainer.js:86 (NodeRedManager.installContainer) Node-RED: container successfully started
2023-09-14T22:10:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:10:00 GMT
2023-09-14T22:11:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:11:00 GMT
2023-09-14T22:12:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:12:00 GMT
2023-09-14T22:13:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:13:00 GMT
2023-09-14T22:14:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:14:00 GMT
2023-09-14T22:15:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:15:00 GMT
2023-09-14T22:16:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:16:00 GMT
2023-09-14T22:17:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:17:00 GMT
2023-09-14T22:17:55+0200 <info> checkForContainerUpdates.js:13 (NodeRedManager.checkForContainerUpdates) Node-RED: Checking for current installed versions and required updates...
2023-09-14T22:17:55+0200 <info> installContainer.js:44 (NodeRedManager.installContainer) Nodered: is being installed as Docker container...
2023-09-14T22:17:55+0200 <info> installContainer.js:45 (NodeRedManager.installContainer) Pulling nodered/node-red:3.1 image...
2023-09-14T22:17:57+0200 <info> installContainer.js:49 (NodeRedManager.installContainer) Nodered: Preparing environment...
2023-09-14T22:17:57+0200 <info> configureContainer.js:16 (NodeRedManager.configureContainer) Node-RED: Docker container is being configured...
2023-09-14T22:17:57+0200 <info> configureContainer.js:36 (NodeRedManager.configureContainer) Node-RED: Writing default configuration...
2023-09-14T22:17:57+0200 <info> configureContainer.js:62 (NodeRedManager.configureContainer) Node-RED: Writting configuration...
2023-09-14T22:17:57+0200 <info> installContainer.js:52 (NodeRedManager.installContainer) Creation of container...
2023-09-14T22:17:58+0200 <info> installContainer.js:57 (NodeRedManager.installContainer) Node-RED: successfully installed and configured as Docker container
2023-09-14T22:17:58+0200 <info> configureContainer.js:16 (NodeRedManager.configureContainer) Node-RED: Docker container is being configured...
2023-09-14T22:17:58+0200 <info> configureContainer.js:34 (NodeRedManager.configureContainer) Node-RED:  configuration file already exists.
2023-09-14T22:17:59+0200 <info> installContainer.js:80 (NodeRedManager.installContainer) Node-RED: container is (re)starting...
2023-09-14T22:18:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Thu, 14 Sep 2023 20:18:00 GMT
2023-09-14T22:18:05+0200 <info> installContainer.js:86 (NodeRedManager.installContainer) Node-RED: container successfully started
2023-09-14T22:19:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers

I still get the same message « connection failed » when I click on the link « ip:1881 »

And if you run the command below, what output do you get?
docker ps -a

I have this

pi@gladys:~ $ docker ps -a
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS                          PORTS      NAMES
18e48c1ff18e   nodered/node-red:3.1        "./entrypoint.sh"        12 minutes ago   Restarting (1) 48 seconds ago              gladys-node-red
090e1056efb1   gladysassistant/gladys:v4   "docker-entrypoint.s…"   30 minutes ago   Exited (137) 12 minutes ago                gladys
bb0a196fdea9   delogzway/gladys:nodered    "docker-entrypoint.s…"   30 minutes ago   Up 30 minutes                              gladys-test-nodered
367ccc7dfe56   containrrr/watchtower       "/watchtower --clean…"   45 minutes ago   Up 45 minutes                   8080/tcp   watchtower
pi@gladys:~ $

Node-RED is restarting in a loop.
Try getting Node-RED logs with docker logs gladys-node-red

I just realized that the container gladys-node-red restarts every minute

Here are some parts of the logs that are looping


Error: EACCES: permission denied, copyfile '/usr/src/node-red/node_modules/node-red/settings.js' -\u003e '/data/settings.js'
    at Object.copyFileSync (node:fs:2847:3)
    at copyFile (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:64:6)
    at onFile (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:50:25)
    at getStats (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:42:44)
    at Object.copySync (/usr/src/node-red/node_modules/fs-extra/lib/copy/copy-sync.js:32:10)
    at Object.\u003canonymous\u003e (/usr/src/node-red/node_modules/node-red/red.js:129:20)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12) {
  errno: -13,
  syscall: 'copyfile',
  code: 'EACCES',
  path: '/usr/src/node-red/node_modules/node-red/settings.js',
  dest: '/data/settings.js'
}

thanks @cce66
I’m testing this :wink:

Probably a permissions issue on a directory, so the copy of the file settings.js cannot be made into the /data directory
You should check the permissions on that directory. It should be owned by 1000:1000.
Try the command
ls -ld /var/lib/gladysassistant/node-red/data
I had a quick look through its code but if it’s not that directory you’ll need to check with @Lokkye

here’s what it shows

pi@gladys:~ $ ls -ld /var/lib/gladysassistant/node-red/data
ls: cannot access '/var/lib/gladysassistant/node-red/data': No such file or directory

So that’s not this folder.
And if you try one level up
ls -ld /var/lib/gladysassistant/node-red

Otherwise I’ll let @Lokkye respond

this is what it shows


pi@gladys:// $ ls -ld /var/lib/gladysassistant/node-red
drwxr-xr-x 2 root root 4096 Sep 14 22:09 /var/lib/gladysassistant/node-red

It’s indeed a permissions issue, the node-red folder belongs to root, hence the permission denied error

@Lokkye, can you do something?

Thanks @_Will_71
node-red is empty and data does not exist in cd /var/lib/gladysassistant/node-red

Is this command good to run the delogzway/gladys:nodered image from @Lokkye?

docker run -d \
--log-opt max-size=10m \
--restart=always \
--privileged \
--network=host \
--name gladys-test-nodered \
-e NODE_ENV=production \
-e SERVER_PORT=8001 \
-e TZ=Europe/Paris \
-e SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/gladysassistant_test_nodered:/var/lib/gladysassistant \
-v /dev:/dev \
-v /run/udev:/run/udev:ro \
delogzway/gladys:nodered

Yes, actually the data folder is the `/var/lib/gladysassistant