Run node-red inside docker using pm2 & upgrade custom nodes
So I am successfully running node red inside docker. Everything works fine until I try to upgrade a node previously installed using the palette. After installing the newer version, node red says "Node-RED must be restarted to enable upgraded modules".
My container is ephemeral and I do not intend to mount a volume onto it (think AWS Fargate).
So I decide to use pm2-runtime to run node red inside a docker container. To restart the node-red process without restarting the container, I expose a REST API to restart the pm2 process like this:
I upgrade the custom node successfully, albeit with the msg "Node-RED must be restarted to enable upgraded modules"
I call "/_restart" REST API, and pm2 restarts the node-red process successfully
However, when I visit node-red in the browser the custom node is still at the previous version and is asking me to upgrade !! All flows are intact as they were.
Q. What happened there? Why didn't process restart work as node-red was expecting?
its a custom built node that is a pass-through "does nothing" "what comes in goes out" "no login"
the custom node sits in a git repo. and the catalog.json makes use of the git+https://.....#tag URL as pkg_url (since its available with NR-v1.0.1)
when I install the node the first time, it was at 1.0.3 and is successfully installed. Then I simple create a new git tag v1.0.4 and update the # tag in the pkg_url of catalog.json (remember - git+https://.....#tag)
So the node is still valid in that sense - there are no issues unless you mean something more when you says "issue with the custom node"
Can you try and update another node - to try and see if it is something with how your node is published rather than a generic issue with updating the docker container ?
After upgrading the node via NR console, I will see it is making any changes to the underlying file system i.e. are the new files (specifically package.json) is stored on the filesystem or not.
The issue was with how I was updating the node. In the git repo. of my node, I was making a new commit and tagging a new version without bumping the version inside the package.json.
This was causing an issues because even after installing the 'new version' from NR editor, the pacakge.json of the node was showing the older version on the file system. Upon restarting NR, it reads the package.json and sees an old version and says "upgrade available".
Special thanks to @craigcurtin for following this through!