Settings.js used in docker, local vs azure

Getting real confused about the settings.js file, which locations it is in and where node-red expects to find it.

When I run node-red locally in docker, it uses /data/settings.js and works as expected.
When running in azure container instance, it reports to use /usr/src/node-red/node_modules/node-red/settings.js

I then tried back and forth to edit Dockerfile to copy settings.js to /usr/src/node-red/node_modules/node-red/settings.js as well as other possible locations like /usr/src/node-red/settings.js and /data/settings.js

Not getting any success until it just happened to work in azure. Now it says it's using /data/settings.js, identical to how it is locally.

Why am I getting these varied results about where settings.js is supposed to be? Why did the same container use different settings.js locally than remote in azure?

Hard to say without reviewing all operations and logs but what i can say is if you see src/node-red/node_modules/node-red/ in the path, your looking at the wrong thing.

Typically the settings.js file is either specified by command line or its in the -u userDir. If you see /data/settings.js then that is fairly regular.

but the most reliable way to tell is to look in the log output of node-RED:

21/08/2024 10:22:52  [info]    Welcome to Node-RED
===================

21/08/2024 10:22:52  [info]    Node-RED version: v4.0.2
21/08/2024 10:22:52  [info]    Node.js  version: v20.15.1
21/08/2024 10:22:52  [info]    Linux 5.10.205-195.804.amzn2.aarch64 arm64 LE
21/08/2024 10:22:53  [info]    Loading palette nodes
21/08/2024 10:22:53  [info]    FlowFuse Assistant Plugin loaded
21/08/2024 10:22:53  [info]    FlowFuse HTTP Authentication Plugin loaded
21/08/2024 10:22:53  [info]    FlowFuse Team Library Plugin loaded
21/08/2024 10:22:53  [info]    FlowFuse Light Theme Plugin loaded
21/08/2024 10:22:53  [info]    FlowFuse Dark Theme Plugin loaded
21/08/2024 10:22:54  [info]    FlowFuse Metrics Plugin loaded
//  ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡ ๐Ÿ‘‡
21/08/2024 10:22:56  [info]    Settings file  : /data/settings.js   <<<<<<<<<<<<<<<   This IS the settings file
// ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† ๐Ÿ‘† 
21/08/2024 10:22:56  [info]    Context store  : 'memory' [module=memory]
21/08/2024 10:22:56  [info]    Context store  : 'persistent' [module=custom]
21/08/2024 10:22:56  [info]    Server now running at http://xxxxxxxxxxx

Thx, yeah that's where I finally figured out the difference. I'm using slightly customized setup of node-red docker (GitHub - node-red/node-red-docker: Repository for all things Node-RED and Docker related). While simple in theory, there's quite a lot of files, scripts and lines to make this work. Ie. Dockerfile, build image bat script, then a total of 4 shell scripts to run inside the container (entrypoint.sh, install_devtools.sh, known_hosts.sh, remove_native_gpio.sh). I'm able to figure out some of it but still some parts confusing.

For example I think it's the entrypoint.sh which sets the useDir:

/usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}" &

But I haven't figured out what the variables are or where they come from. Then similar start script in package.json. Feels like whenever I look for something, I find it partially in multiple places (better than not finding it at all haha).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.