Image support storage plugin

hi
any docker image to support mongodb storage plugin

Have you tried node-red-mongo-storage-plugin - npm

I see you have edited your OP so my answer makes less sense now.

You may have to build your own image to include the mongo storage plugin

See Running under Docker : Node-RED

thx to reply but not work

2022-06-26 12:46:37.43 UTCnr-6b4cf6c8fd-c5m7nnr> node-red-docker@2.2.2 start /usr/src/node-red
2022-06-26 12:46:37.43 UTCnr-6b4cf6c8fd-c5m7nnr> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
2022-06-26 12:46:37.43 UTCnr-6b4cf6c8fd-c5m7nnr
2022-06-26 12:46:38.53 UTCnr-6b4cf6c8fd-c5m7nnr(node:17) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
2022-06-26 12:46:38.53 UTCnr-6b4cf6c8fd-c5m7nnr(Use `node --trace-warnings ...` to show where the warning was created)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr26 Jun 21:46:38 - [red] Uncaught Exception:
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr26 Jun 21:46:38 - [error] TypeError: Cannot read property 'db' of undefined
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/node-red-mongo-storage-plugin/MongoHandler.js:22:33
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/mongodb/lib/utils.js:695:9
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/mongodb/lib/mongo_client.js:285:23
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at connectCallback (/usr/src/node-red/node_modules/mongodb/lib/operations/connect.js:367:5)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/mongodb/lib/operations/connect.js:434:14
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Server.<anonymous> (/usr/src/node-red/node_modules/mongodb/lib/topologies/server.js:231:11)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Object.onceWrapper (events.js:520:26)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Server.emit (events.js:400:28)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Pool.<anonymous> (/usr/src/node-red/node_modules/mongodb/lib/core/topologies/server.js:439:21)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Pool.emit (events.js:400:28)
2022-06-26 12:46:38.55 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! code ELIFECYCLE
2022-06-26 12:46:38.55 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! errno 1
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! node-red-docker@2.2.2 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! Exit status 1
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! 
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! Failed at the node-red-docker@2.2.2 start script.
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.

so I am use this

node-red boot without error

2022-06-26 12:51:16.00 UTCnr-694ff4bf48-w6bd6[pod-event]Created container nr
2022-06-26 12:51:17.00 UTCnr-694ff4bf48-w6bd6[pod-event]Started container nr
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr> node-red-docker@2.2.2 start /usr/src/node-red
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] 
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nrWelcome to Node-RED
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr===================
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] Node-RED version: v2.2.2
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] Node.js version: v14.18.2
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] Linux 5.4.0-1051-gke x64 LE
2022-06-26 12:51:20.10 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:20 - [info] Loading palette nodes
2022-06-26 12:51:20.12 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:20 - [error] Error: ENOENT: no such file or directory, open '/data/package.json'
2022-06-26 12:51:21.15 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Settings file : /data/settings.js
2022-06-26 12:51:21.15 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Context store : 'default' [module=memory]
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [warn] 
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr---------------------------------------------------------------------
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrYour flow credentials file is encrypted using a system-generated key.
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrIf the system-generated key is lost for any reason, your credentials
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrfile will not be recoverable, you will have to delete it and re-enter
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nryour credentials.
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrYou should set your own key using the 'credentialSecret' option in
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nryour settings file. Node-RED will then re-encrypt your credentials
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrfile using your chosen key the next time you deploy a change.
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr---------------------------------------------------------------------
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.23 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Server now running at http://127.0.0.1:1880/
2022-06-26 12:51:21.23 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Starting flows
2022-06-26 12:51:21.24 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Started flows

but editor frozen when loading the nodes
Sans titre

add this pice to settings.json file

   storageModule: require('node-red-contrib-storage-mongodb/nrs'),
    mongodbSettings: {
        mongoURI: 'mongodb://mongodb:27017',
        appname: 'r1'
    },

dockerfile

FROM nodered/node-red:latest

COPY settings.js /data/
USER root
RUN chown -R node-red:root /data
USER node-red
RUN npm install --no-fund --no-update-notifier --save node-red-contrib-storage-mongodb
#RUN npm install --no-fund --no-update-notifier --save node-red-mongo-storage-plugin
ENTRYPOINT npm start --  --userDir /data

From your logs I see you are running Node-RED 2.2.2 on NodeJS v14.18.2 in docker

I would suggest the first step is to verify the plugin actually works for Node-RED 2.2.2 & NodeJS v14.18.2 OUTSIDE of docker.

If it does work outside of docker, then I would start looking at your docker networking and checking mongoURI etc.

If it does not work even outside of docker (with these version of node-red/nodejs), then I would raise an issue on the repository (or fork and fix yourself)

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