Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add design note for standalone Node-RED #30

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ with enough detail to review the intent and direction of the feature.
- [Node Timeout API](designs/timeout-api.md)
- [Overwrite Values in settings.js](designs/overwrite-settings.md)
- [Admin API Authentication](designs/admin-api-authentication.md)
- [Standalone Node-RED](designs/standalone-nodered/README.md)

#### In-progress

Expand Down
89 changes: 89 additions & 0 deletions designs/standalone-nodered/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
state: draft
---

# Standalone Node-RED

## Summary

The standalone Node-RED is a desktop version of Node-RED which includes Node-RED, Node.js, nodes, and browser engine using Chromium.

## Authors

- @kazuhitoyokoi

## Use Cases

- Easy installation

With the Node-RED installer, it will be easy for users to set up the Node-RED environment.
Especially, the targets are users who have no CLI skills to install Node-RED using commands like `npm install`.

- Offline installation

It is suitable for offline use cases because it contains all necessary components to execute Node-RED.

- Integrated Development Environment (IDE)

The standalone Node-RED behaves as IDE application like VS Code or Eclipse.
Therefore, users may want to switch multiple projects for various environments on their single computer.
Additionally, they need git functionality as default to proceed with team development or backup their flows.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so would this also install git ? Or is git a prereq ? Or should it autodetect and not enable projects etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If installer support to install git command, we need to add different handlings for Windows, macOS, Linux environments. Therefore, I think that prereq and auto-detection are suitable for the project feature on the standalone Node-RED.


## Details

### Flow editor window
The window is used for the Node-RED flow editor. After executing the standalone Node-RED, the window will be opened automatically.

- Dialog when closing window

When closing the window without saving the flow, the window show dialog to select "save & exit" or "cancel".
It is implemented using electron dialog or Node-RED notify UI.

- Debug window, event log window

To check the debug tab and event log in another window, users can open these UIs in a single window.
(To realize this functionality, The event log UI in Node-RED core requires ”Open in new window” button which is same as debug tab)

### Runtime
The Node-RED runtime will be executed when the standard Node-RED starts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it always try to run a flow ? last opened flow ? Or should it always start in "safe mode" - as this is now more of an IDE model.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. "safe mode" is natural in an IDE model. I added the text about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I agree. It really depends how far down the IDE model you want to go.

A full IDE like model would let you open up multiple different flow files, save them separately, run more than one... is that the type of model we want? Until we've set out the basic scope of the IDE, then we simply cannot start discussing individual details about the implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knolleary Thank you for your comments. I added the scope of the standalone Node-RED. Could you review it?

Not to execute the flow until clicking the deploy button (same behavior as run button other IDEs), it runs in the `--safe` mode as default.
In case of executing the flow immediately in the start-up process, `--normal` mode should be set as an option to disable `--safe` mode.

- Admin API

The URL to connect between window and runtime uses a random path and fixed port number because the flow editor needs to be prohibited from other users and allow access REST API endpoints using http-in nodes which require the fixed port number. The following URL is an example of the admin API which window accesses.

http://localhost:1880/< random path >

- settings.js file

Instead of default `~./node-red/` directory, the standalone Node-RED uses `~./node-red-standalone/` directory to avoid changing the current environment under `~/.node-red/` directory.
The standalone Node-RED has the default `settings.js` file. When there is no `settings.js` file under `~/.node-red-standalone/` directory, the standalone Node-RED saves the default `settings.js` file to load the custom settings in the following table.

| key | value |
| ---------------------------- | ----- |
| editorTheme.projects.enabled | true |

The git command is a prerequisite if users want to use the project feature.
Node-RED automatically detects git command and enables the feature if it is installed.

### Logging
Users can see log data in real-time on the event log window. On the other hand, users can also see historical log data from log files.
If the `electron-log` module is used to implement logging functionality, the following paths are default file paths to store log data.

- Windows: C:\Users\\< User name >\AppData\Roaming\node-red\logs\file.log
- macOS: ~/Library/Logs/node-red/file.log
- Linux: /var/log/node-red.log

### Building binaries
`npm run build` command builds binaries for the following OS environments.

- Windows (msi)
- macOS (dmg)
- Linux (tar.gz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

electron-builder can build deb and rpm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, electron-builder can build various types of binaries. To reduce our tasks to check all binaries in every release, I wrote three major binaries. I would like to suggest documentation about how to build other binaries like deb and rpm.


The procedures about how to build other binaries like deb and rpm will be available in the documentation.

## History

- 2019-05-19 - Initial proposal