[nodered] container status shows unhealthy because of script checks
shantanoo-desai opened this issue · 1 comments
shantanoo-desai commented
Description
upon docker inspect -f "{{json .State.Health }}" | jq "."
the node-RED container performs health checks where it requires the /data/settings.js
. The is based on the healthcheck.js
which requires the /data/settings.js
file. This however does not break the functionality and the container, but in order to mitigate any future crashes, revert to mounting the settings.js
file to the /data
directory with read-only permissions
Logs
{
"Status": "unhealthy",
"FailingStreak": 14,
"Log": [
{
"Start": "2023-07-26T14:05:23.628590356+02:00",
"End": "2023-07-26T14:05:23.739666703+02:00",
"ExitCode": 1,
"Output": "node:internal/modules/cjs/loader:936\n throw err;\n ^\n\nError: Cannot find module '/data/settings.js'\nRequire stack:\n- /healthcheck.js\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:1005:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/healthcheck.js:3:16)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\n at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\n code: 'MODULE_NOT_FOUND',\n requireStack: [ '/healthcheck.js' ]\n}\n"
},
{
"Start": "2023-07-26T14:05:53.749042519+02:00",
"End": "2023-07-26T14:05:53.868606058+02:00",
"ExitCode": 1,
"Output": "node:internal/modules/cjs/loader:936\n throw err;\n ^\n\nError: Cannot find module '/data/settings.js'\nRequire stack:\n- /healthcheck.js\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:1005:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/healthcheck.js:3:16)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\n at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\n code: 'MODULE_NOT_FOUND',\n requireStack: [ '/healthcheck.js' ]\n}\n"
},
{
"Start": "2023-07-26T14:06:23.877549094+02:00",
"End": "2023-07-26T14:06:23.99856726+02:00",
"ExitCode": 1,
"Output": "node:internal/modules/cjs/loader:936\n throw err;\n ^\n\nError: Cannot find module '/data/settings.js'\nRequire stack:\n- /healthcheck.js\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:1005:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/healthcheck.js:3:16)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\n at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\n code: 'MODULE_NOT_FOUND',\n requireStack: [ '/healthcheck.js' ]\n}\n"
},
{
"Start": "2023-07-26T14:06:54.014822311+02:00",
"End": "2023-07-26T14:06:54.138826011+02:00",
"ExitCode": 1,
"Output": "node:internal/modules/cjs/loader:936\n throw err;\n ^\n\nError: Cannot find module '/data/settings.js'\nRequire stack:\n- /healthcheck.js\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:1005:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/healthcheck.js:3:16)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\n at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\n code: 'MODULE_NOT_FOUND',\n requireStack: [ '/healthcheck.js' ]\n}\n"
},
{
"Start": "2023-07-26T14:07:24.155280227+02:00",
"End": "2023-07-26T14:07:24.309153891+02:00",
"ExitCode": 1,
"Output": "node:internal/modules/cjs/loader:936\n throw err;\n ^\n\nError: Cannot find module '/data/settings.js'\nRequire stack:\n- /healthcheck.js\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\n at Function.Module._load (node:internal/modules/cjs/loader:778:27)\n at Module.require (node:internal/modules/cjs/loader:1005:19)\n at require (node:internal/modules/cjs/helpers:102:18)\n at Object.<anonymous> (/healthcheck.js:3:16)\n at Module._compile (node:internal/modules/cjs/loader:1105:14)\n at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\n at Module.load (node:internal/modules/cjs/loader:981:32)\n at Function.Module._load (node:internal/modules/cjs/loader:822:12)\n at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\n code: 'MODULE_NOT_FOUND',\n requireStack: [ '/healthcheck.js' ]\n}\n"
}
]
}
shantanoo-desai commented
Patch
diff --git a/templates/services/docker-compose.nodered.yml.j2 b/templates/services/docker-compose.nodered.yml.j2
index 764d5ad..7e1a622 100644
--- a/templates/services/docker-compose.nodered.yml.j2
+++ b/templates/services/docker-compose.nodered.yml.j2
@@ -28,9 +28,6 @@ services:
image: docker.io/nodered/node-red:{{ komponist.configuration.nodered.version | default('latest') }}
{% endif %}
container_name: komponist_nodered
- configs:
- - nodered_settings
- entrypoint: node-red -s /nodered_settings
logging:
options:
max-size: "5m"
@@ -42,14 +39,11 @@ services:
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
+ - ./nodered/settings.js:/data/settings.js:ro
{% if komponist.data_persistence | default(false) %}
- nodered:/data
volumes:
nodered:
-{% endif %}
-
-configs:
- nodered_settings:
- file: ./nodered/settings.js
\ No newline at end of file
+{% endif %}
\ No newline at end of file