Intégration Node-RED pour lancer un container en un clic

c’est pas 1880 le port par défaut pour node-red ?

bonjour @cce66
Pour eviter les conflits avec un node red deja installé @Lokkye l’a passé sur le port 1881, c’est ce que j’ai lu :wink:

Dans ce cas télécharge

Et vérifie le port sur lequel est connecté node-red (il faut mettre l’ip de ta machine a gauche et la plage de port recherchée dans la zone en bleue

C’est bien le port 1881 pour ne pas faire de conflit avec une installation Node-RED existante.

image

@Psoy peut-être que les logs pourront aider
Vérifie aussi avec docker si le container est bien exécuté sans erreur.

Merci pour ton aide, mais j’ai laissé tomber, car j’ai des grosses lenteurs sur mon PI , je vais m’y remettre et réessayer

Voila les 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

j’arrive toujours au meme message " connexion echouée ", quand je clique sur le lien « ip:1881 »

et si tu fais la commande ci dessous, tu as quoi comme retour?
docker ps -a

j’ai ca

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 redémarre en boucle.
Essais de mettre des logs de Node-RED avec docker logs gladys-node-red

Je viens de me rendre compte que le container gladys-node-red, redemarre toutes les minutes

voici une parties des logs qui tournent en boucle


Error: EACCES: permission denied, copyfile '/usr/src/node-red/node_modules/node-red/settings.js' -> '/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.<anonymous> (/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'
}

merci @cce66
je teste ça :wink:

Surement un problème de droit sur un dossier et du coup la copie du fichier settings.js ne peut pas se faire dans le dossier /data
Il faudrait voir les droits sur ce dossier. Il doit appartenir à 1000:1000.
Essai la commande
ls -ld /var/lib/gladysassistant/node-red/data
J’ai regardé vite fait dans son code mais si n’est pas ce dossier il faudra voir avec @Lokkye

ça donne ça

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

Donc c’est pas ce dossier.
Et si tu essais un cran avant
ls -ld /var/lib/gladysassistant/node-red

Sinon je laisse répondre @Lokkye

ça donne ça


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

C’est bien un problème de droit, le dossier node-red appartient à root d’où l’erreur de permission denied

@Lokkye , tu peux faire quelque chose?

Merci @_Will_71
node-red est vide et data n’existe pas dans cd /var/lib/gladysassistant/node-red

1 « J'aime »

Cette commande est bonne pour lancer l’image delogzway/gladys:nodered: de @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

Oui en faite le dossier data en en faite le dossier /var/lib/gladysassistant/node-red
Et ce dossier est vide justement car node-red ne peut pas écrire dedans