FlowFuse / nr-launcher

A Laucher for Node-RED that allows settings to be loaded at startup.
Apache License 2.0
4 stars 5 forks source link

Add required entries in settings.js to move ui-builder data to persistent storage. #253

Closed hardillb closed 1 week ago

hardillb commented 2 weeks ago

Description

https://totallyinformation.github.io/node-red-contrib-uibuilder/#/

...
  uibulder: {
    uibRoot: '/data/storage/uibuilder'
  },
...

Requested By

hardillb commented 1 week ago

@joepavitt this is what's needed to make UI builder work

joepavitt commented 1 week ago

@totallyinformation has just signed up to FlowFuse, so if we can get this in soon, it'd be great for him to have a play and see what he could build

TotallyInformation commented 1 week ago

He has 😁, and thanks Joe for your support. If we get get this working, I can also write up something about use of the FF authentication with UIBUILDER. Hopefully document a decent flow.

hardillb commented 1 week ago

The trick here will be working out the path for the localfs version, we can't just hardcode /data/storage as the path

TotallyInformation commented 1 week ago

Can it be based around the existing userDir setting?

But even if not, as long as we get the location in a variable that can be accessed by node runtimes, we can work with it. Currently, UIBUILDER uses the userDir as the base folder and adds the sub-folder uibuilder. Everything else for it sits under that. However, uibuilder already allows for changing that folder to anywhere using the settings.js file.

knolleary commented 1 week ago

@hardillb if the storage directory is predictably adjacent to the location of settings.js, we'll know the relative location to the settings file - so can do something like the following inside the generated settings.js file:

const path = require('path')
const persistentStorageDir = path.join(__dirname, 'storage')
hardillb commented 1 week ago

We get the projects root in the settings from the driver at start up so we can build it all if needed, but the relative path of settings.js is cleaner and will work the same for all.

Once I fix my dev env I'll get a PR opened

hardillb commented 1 week ago

@TotallyInformation is there a settings.js option to disable the VSCODE button? Since if I understand correctly that won't work with a remote host (the link appears to open the folder directly as if it's on the local machine).

Or does that only show up if the hostname is localhost?

TotallyInformation commented 1 week ago

@hardillb No, not currently. And yes, currently it only shows up for localhost

However, v7 also introduces an advanced setting to allow the edit button link to be customised and also adjusts the link to a VScode remote link if it recognises that the server is remote to the Editor client. So the button appears for remote as well as local installs.

So is there a good way to know if Node-RED is running under a FlowFuse environment?

If there is, I can automate turning off for v7 which is close to release.

hardillb commented 1 week ago

There are a number of environment variables that will be in scope e.g. FF_INSTANCE_ID

hardillb commented 1 week ago

@TotallyInformation just so you know, while this is merged, it is not deployed to the production FlowFuse Cloud yet.

We will double check kick the tires on our staging env tomorrow and then decide when it will be deployed to production.

TotallyInformation commented 1 week ago

Thanks @hardillb - great to see things moving rapidly. I'll be ready to test whenever.

The library examples have plenty of content for testing a lot of the features.