Make complete working copy of existing Node-RED install

em...

  1. How can I edit it to disable it before I enable it (chicken/egg)

  2. Isn't that the point of safe mode?

What i mean is - if you have any nodes that perhaps output to MQTT or to Database that you DONT want the 2nd instance to perform (as it could muck up the data first instance) you should change them or disable them so you dont have issues when you finally allow the 2nd instance to RUN.

Once both are running, the first instance may wellstill be doing all the work (initially) but you can begin to transfer logic between the two, you disable 1 part (in NR1) and enable (in NR2) that piece of logic (as quick as possible ;)). there are ways of minimising outage though (only you know your logic)

There is no real science to it - all i can really say is your approach (to minimise downtime) should be logical and staged.

To clarify, safe mode doesnt start your flow (node-red starts but flow doesnt execute) - so you are SAFE to run both instances. My point was when you DEPLOY changes to the 2nd instance - it WILL start running the flows (i.e. it drops out of safe mode)

Are you saying that I won't be able to disable some tabs in 2nd instance when I'm in safe mode?

#ConfusedOfEuxton :slight_smile:

Even more confused as your editing your post as I'm typing :slight_smile:

Got it now (after your last edit :slight_smile:

I'm not as thick as you think I am but it is good to proceed with that in the first place :slight_smile:

So - I am copying my .node-red folder
image

I will enable safe mode BEFORE starting my new instance

I will disable crictical tabs in new instance

I will restart new instance in normal mode

Right? :slight_smile:

No

you can do everything

Its just when you deploy - the runtime kicks in.

So be sure to disable anything that might interfere BEFRE deploy (as the runtime will kick in)

Pretty much spot on - though to clarify...

After your copy is done...

  • Fire up the new instance with --safe flag in the command line
  • disable crictical tabs in new instance
  • deploy so that modifications are saved (flow will start running after deploy)

Next time you start the 2nd instance, remove --safe

1 Like

PS, There is another way...

you can start another instance WITHOUT copying anything in just by creating an empty folder & starting node-red with the correct command line parameters.

This would fire up another instance but completely EMPTY - then you could migrate elements of your first flow piece by piece.

You can run even more instances for times when you are testing and trailing stuff.
Just remember to set a different path and port number.

This thread is clearer

1 Like

Just for clarification - if I'm launching from cd ing to the c:\users\simon\.node-red2 folder, do I need to specify c:/nr1881 in my command line?

And should not c:/nr1881 be the folder where the 2nd instance file are in? e.g c:\users\simon\.node-red2 in my case?

oh no.....

node-red -p 1881 -u c:/users/simon/.node-red2 --safe will do it.

the -u says - use this folder (and everything in side - i.e. your copy)

If you were to run node-red -p 1881 -u c:/nr1881 --safe it would try to use c:\nr1881 (it was just an example - i prefer to name the instance in a way that identifies what port they will be running as)

:slight_smile:
Ok - so I'm going to rename c:/users/simon/.node-red2 to c:/users/simon/.nr1881 and then use

node-red -p 1881 -u c:/users/simon/.nr1881 --safe

to launch it - yes?

Looks good Simon - fire away.

1 Like

wish me luck.... :slight_smile:
image

[edit] taking a while to get going- (well you would if you had 110 tabs in the flow :slight_smile:


[/edit]
[edit2]Looking good but been called back outside to do gardening work :frowning:

[/edit2]

1 Like

Going thru disabling all conflicting type tabs/flows - thinking I maybe should have done a global search and replace in a text editor on the flows.json file instead :slight_smile:

[edit] OK - disabled all the 24/7 flows that I run on the main instance and deployed

Saw these two errors (which are to do with my contrib-alexa-remote2 nodes)

image

So I'm thinking that I'll remove that set of nodes as probably not designed to be running on the same machine in two separate instances

port conflict by the looks of it

but so far so good anyhow.

In future, when you want to do dev/test stuff - you now know you can spin up another instance

node-red -p 1882 -u c:/users/simon/.nr1882

Happy days.

Probably a little late @Steve-Mcl ... but wouldn't it have been easier just to copy and rename the flows file, and then it would start by default with flows.json, and the second flows file (archive.json) could be optionally selected via the start command?

for example; node-red archive.json

True yes but the topic was "Make a complete working copy" - so...

And anyhow, if Simon wants to update / change / remove some nodes, it would affect both instances if he did that.

This method gives isolation.

There isn't really a better way - just depends what your requirements are.

2 Likes

Simon, I couldn't get this to work on 2 different machines at all!

OK - alexa-remote2 nodes removed from 2nd instance and that is all OK

Just going thru deleting un-wanted tabs from my main instance but I've got bored after 1st 20 so calling it a night and will resume tomorrow but all looking good so far :slight_smile:

Your other option and one i find a little more useful - is to spin up a virtual machine on the same system - you can then assign it a seperate IP Address - so no need for port changes etc - you can also stop any communication into and out of the VIrtual machine so can leave everything "as is" and only open the machine up when needed.

This gives you a sandboxed environment where you can happily test all upgrades (NR, NPM, NODEJS) without any fear of them interfering with your production system prior to deploying into live

Craig

Craig

1 Like

Made it - cut back to 18 tabs :slight_smile:
Prob don't even need half of them but I'll run like this for a while and see how it goes

To summarise this thread:

I stopped Node-RED from running

Created a folder called c:\users\simon\.nr1881

Copied all files from c:\users\simon\.node-red to c:\users\simon\.nr1881
cd'd into c:\users\simon\.nr1881

Ran node-red -p 1881 -u c:/users/simon/.nr1881 --safe

Disabled any of the tabs I intended to keep running on my standard install

Deployed

(Also removed an alexa contrib node in .nr1881 instance due to port conflicts but that was just peculiar to my setup)

Launched new instance using node-red -p 1881 -u c:/users/simon/.nr1881

Launched my standard install as normal

Deleted all the un-needed tabs in standard install

Happiness :slight_smile:

Thanks @Steve-Mcl :slight_smile:

3 Likes