From 7668e31693f5326ffcd4858d824b6154350f3e52 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Fri, 6 Apr 2018 16:13:31 +0100 Subject: [PATCH] Updated Design: Runnable Project (markdown) --- Design:-Runnable-Project.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Design:-Runnable-Project.md b/Design:-Runnable-Project.md index 535c37c..6b44db4 100644 --- a/Design:-Runnable-Project.md +++ b/Design:-Runnable-Project.md @@ -16,9 +16,12 @@ It should be possible to deploy a project without using the editor. For example: We can't quite do this today. Here are the missing pieces: 1. the project's `package.json` needs to list `node-red` as a dependency. On balance, I think this is the right approach, rather than treat node-red as an assumed prerequisite. I don't think we should do this be default; maybe add a checkbox in the project settings' dependencies page to include `node-red`. -> DCJ: Yes - agree it should be a dependency. Currently not hard to add manually, but could be even easier. It would be a prerequisite dependency for inside a Docker container. +> DCJ: Yes - agree it should be a dependency. Currently not hard to add manually, but could be even easier. It would be a prerequisite dependency for inside a Docker container. + +>DCJ: Added a button to dependencies panel to add node-red core - As it's not "known" it shows as greyed in the list- but I actually think this is good, as it indicates it may not be required also. 2. it must be possible to point node-red at a project on start-up, without using the editor to do so. Currently we overload the flowFile argument to set the active project - but that only works if the project is 'known'. It would be better to point at a `projectDir` wherever it may exist. > DCJ: Are we pointing Node-RED or npm start ? Which are we calling to run it ? If npm start then don't we already have to be in the correct project directory ? (or use npm start --prefix projectDir) + > DCJ: Having played with it a while - I think `npm start` from within the relevant directory is the way to go to start with. 3. it must be possible to provide the credentialSecret for the project without it being part of any of the version controlled files. Options for this include: - env var - `NODE_RED_CREDENTIAL_SECRET` @@ -32,8 +35,7 @@ We can't quite do this today. Here are the missing pieces: - setting disableEditor to `true` also. The package would provide an npm start script that runs node-red with the appropriate command-line args. - -> DCJ: If you run the steps above then node-red and other modules will be installed *below* the CWD in node_modules... all good. If however we want to take our project dir and npm pack it... on re-installing it the project itself will also be in the node_modules dir thus making npm start (or pathing back to node-red) trickier. +> DCJ: currently just using `node-red -u . flow.json` - i.e. start Node-RED using the current directory as the base and the current flow file. It could also provide a `bin` section that could allow starting via command line if installed globally - but that requires a command to be run (that doesn't take parameters) so in order to do that we would also need to create that script/.js file or provide a template. @@ -42,7 +44,7 @@ It could also provide a `bin` section that could allow starting via command line ### Runtime settings When deploying the project, there will also be a need to have the runtime settings provided. These are not normally part of a project generated by Node-RED. The question is whether we have some tooling support to generate, or we just document how to do it. For example, the user would manually add a `settings.js` file to their project repo. -> DCJ: If we have the "add node-red as a dependency" checkbox - could it not also... "copy default settings.js into project" or create a minimal settings.js (i.e. without defaults and comments) ? (but ensuring flowFile doesn't clash) e.g. +> DCJ: If we have the "add node-red as a dependency" button - could it not also have a ... "copy default settings.js into project" button or create a minimal settings.js (i.e. without defaults and comments) ? (but ensuring flowFile doesn't clash) e.g. ``` module.exports = {