Closed ZJvandeWeg closed 2 years ago
This is blocked by #464 - and more specifically, the comments on security here
We can make some progress on this in parallel to #464 - getting the node repository created and the basic structure of the nodes in place.
@flowforge/project-nodes
The nodes will require some settings to be provided via settings.js to cover the following:
Currently, a Project Access Token doesn't have access to the platform API - only the storage API used by the runtime storage plugin. This will require the project to be able to call an API to get a list of projects in the team. Whether that is the existing /api/v1/teams/XYZ/projects
api, or one dedicated for projects to use is TBD. But we should take care to only expose the minimum of information needed (project id/name - no other details)
The high level concept of project links is inbox/outbox
inbox being what is sent directly to a project (a project/device has its own inbox)
outbox being what a project broadcasts to anyone who cares to listen
Other notes...
sub-topic
designSubscription ACLs | Can subscribe to... | Publish ACLs | Can publish to... |
---|---|---|---|
Receive messages from other projects | ff/v1/<team>/p/<own-project>/in/+/# |
Send messages to other projects | ff/v1/<team>/p/<any-project>/in/+/# |
Receive broadcasts from other projects | ff/v1/<team>/p/<any-project>/out/+/# |
Send broadcast message | ff/v1/<team>/p/<own-project>/out/+/# |
ff/v1/<team>/p/<any-project>/in/<level1>/<leveln>
<any-project>
is the target you want to send to<level1>
is equivalent to motor1
in the example motor/1/speed
<leveln>
is equivalent to 1
and speed
in the example motor/1/speed
level1
topic, sub topics are optionalpower/status
, waterflow/status
, monitor/motor/1/speed
, etc/
as is appended to the underlying topic structureuserProperties
?
ff/v1/<team>/p/<own-project>/out/<level1>/<leveln>
<own-project>
is the ID of this project<level1>
is equivalent to motor1
in the example motor/1/speed
<leveln>
is equivalent to speed
in the example motor/1/speed
level1
topic, sub topics are optionalpower/status
, command/stop
, etc/
as is appended to the underlying topic structureff/v1/<team>/p/<project>/res/<level1>/<leveln>
responseTopic
. This should be identical to the calculated publish topic that the link call node uses except for index 5 of the full topic should be /res/
instead of /in/
Regarding the initial design work for "Project Link" plugin, it is helpful to me (and hopefully others) to have a human digestible scenario based on the table of topics (https://github.com/flowforge/flowforge/issues/464#issuecomment-1155300019)
A small team of 6 people manage a small wind farm (20 devices).
The team name for this scenario is "wind-farm-1"
graph TD;
classDef team fill:#555,stroke:#333,stroke-width:2px
classDef project fill:#aaa,stroke:#333,stroke-width:2px,color:#000
classDef device fill:#cef,stroke:#123,stroke-width:2px,color:#000
PM[/project-main/]:::project---PD1[/project-v1/]:::project;
PM----PD2[/project-v2/]:::project;
PD1---PD2;
PD1---Device_1:::device;
PD1---Device_2:::device;
PD1---Device_x:::device;
PD2---Device_11:::device;
PD2---Device_12:::device;
PD2---Device_1x:::device;
Figma: https://www.figma.com/file/hr6tk073P2lIDdLdrczMeK/Project-Link-Nodes?node-id=0%3A1
link-in/out/call
nodes.
project-link-in/out/call
nodes transmission should be considered an envelope and the data passed is a complete msg
objecttimeout
property similar to link-call
A node can target a specific project and send a msg
via the "Send message to project" topic structure
e.g.
project-main
motor/1/speed
data: {"uom":"rpm", "value":"400"}
the user facing topic motor/1/speed
would be ff/v1/wind-farm-1/p/project-main/in/motor/1/speed
under the hood.
A node can send a msg
on the "Send broadcast" topic structure
e.g.
Broadcast message to all projects
motor/1/speed
The user facing topic motor/1/speed
would be ff/v1/wind-farm-1/p/<own-project>/out/motor/1/speed
under the hood.
Any project wishing to receive a broadcast would subscribe to ff/v1/wind-farm-1/p/<a-project>|+/out/motor/1/speed
The a project-link-out node requires a means of returning a message that originated from a project-link-call
To know where to send the msg next, a LIFO
stack in the msg
will be required
Philosophy - Project-Link nodes will transmit a msg
just like the Link-in/out
nodes.
From the above descriptions, we can conclude the Project-Link-Out node requires the following fields...
[...list_of_projects_in_THIS_team]
)The "in" node will receive a msg
that is sent from another project when the topic
matches a sent message and the message is directed to this project by selecting the source option "Receive messages sent to this project"
Accessing data from project-v1
in project-main
, the user would
motor/1/speed
project-v1
motor/1/speed
at project project-main
...project-main
project-link-in
node subscribes to the user facing topic motor/1/speed
as ff/v1/wind-farm-1/p/project-main/in/motor/1/speed
Accessing data from 1 or all projects in the team, the user would select the source option "Listen for broadcast messages from" then select all projects
or a specific project and enter a sub-topic e.g. motor/1/speed
In accessing data from all projects in the team with topic motor/1/speed
, the Project-Link-In node subscribes to ff/v1/wind-farm-1/p/+/out/motor/1/speed
In accessing data from a specific project in the team with topic motor/1/speed
, the Project-Link-In node subscribes to ff/v1/wind-farm-1/p/<project-id>/out/motor/1/speed
From the above, we can conclude the Project-Link-In node requires the following fields...
["all projects", ...list_of_projects_in_THIS_team]
<project>
from the list, this node would be to only receive broadcast transmissions from a single projectall
would receive broadcast transmissions from a all projectsThe project-link-call node functions like the current link-call
node in that it expects a project-link-out
node to return the msg
along with the original msg
sub properties identifying the caller.
To perform the command/response pattern, the MQTTv5 property responseTopic
should be utilised.
The project link will only support project-to-project (no broadcast)
The project link call will support nested calls
A timeout should be set. Default 30s (open to debate) A target project must be set A topic must be entered.
ff/v1/wind-farm-1/p/project-main/res/motor/1/speed
which matches up with the publish topic ff/v1/wind-farm-1/p/project-main/in/motor/1/speed
For supporting nested calls, an event should be placed in a lookup and data added to the msg
s projectLink
LIFO stack (for routing)From the above, this proposal suggests the use of MQTT v5 response topic for routing back to the caller.
[...list_of_projects_in_THIS_team]
sub-topic
is open to debate but should try not to call it topic
since it is actually a sub-topic or topic extension project-link-in
so the user can "copy path" without ever deploying (aids development)userProperties
we could include a specific ENV VARs (like device ID, event time)@knolleary
The nodes will require some settings to be provided via settings.js to cover the following:
- FlowForge API URL & token - to be able to query the platform to get a list of projects in the same team as this one.
- Broker connection details - url/credentials
Something like (UPDATE 2022/07/25)...
flowForge: {
baseURL: '${settings.storageURL}', // FORGE_URL
teamID: '${settings.teamID}', // the team hash passed via env var FORGE_TEAM_ID
projectID: '${settings.projectID}', // FORGE_PROJECT_ID
deviceID: '${settings.projectID}', // present if deployed to a device?
projectLink: {
token: '${settings.projectToken}',
broker: {
url: xxxx // value computed from platform
username: xxxx, // value computed from platform
password: xxxx, // value computed from platform
clientId: null // value computed from platform? // << generated from username + ":n" if missing
}
}
node-red project link node (UI)
→ node-red project link node (Runtime endpoint)
→ platform (GET '/:teamId/projects')
→ launcher
→ node-red project link node
?
Discussion on where these would fit within our Pricing (https://flowforgeworkspace.slack.com/archives/C032Q63FGG1/p1658494235857459)
[nick]
Where do the Project nodes sit on the pricing plan then?
[nick]
I don’t see them listed in the pricing table
[Sam Machin]
:thinking_face: I don’t think we have any capability in the current billing concepts for controlling nodes based on tier,
We could limit their access based on a template? but templates are not associated to projectTypes,
I guess we could include them in the stack when its built? that could then limit them to specfic project types, and would be preferable over having them installed from npm anyway?
I’m just thinking through the scenarios of a user having 2 projects (small and medium) but they can’t communicate between them.
The ideal place from a user perspective is in the team tier I think, then you get it on all the projects that team has,
[nick]
Personally I think the nodes should be a CE feature
[nick]
… if they are a team tier thing, then we can’t ship them until we have team tiers
[nick]
or if it is a CE -vs- EE thing, then we need to add license checks into all the work I’ve done so far
[nick]
and move the code to the EE part of the code base
[Sam Machin]
I can see that trying to retrofit them to billing isn’t ideal, and we don’t have all the capabilities that we would need to do that right now anyway.
I’m just very aware that we’re still giving away all our value add at the lowest tiers which makes it harder to drive the higher revenue points….
[Sam Machin]
However from an FF cloud perspective I can see that these nodes make it more useful to have multiple projects (rather than several sets of flows in one) and that in turn would drive revenue
[Sam Machin]
Based on that lets keep these nodes as a CE feature, but it does highlight the importance of getting the billing and licensing frameworks into a ready state before we build more features
Summary, Inter-project Communications Nodes will be available to all Editions and Tiers.
I'm worried that we're throwing away differentiating features this way. We should be building the Delta between CE and EE. Every release it stays the same is a missed opportunity from the product sales perspective Op 25 jul. 2022 09:57 schreef Sam Machin @.***>:
Discussion on where these would fit within our Pricing (https://flowforgeworkspace.slack.com/archives/C032Q63FGG1/p1658494235857459)
[nick]
Where do the Project nodes sit on the pricing plan then?
[nick]
I don’t see them listed in the pricing table
[Sam Machin]
:thinking_face: I don’t think we have any capability in the current billing concepts for controlling nodes based on tier,
We could limit their access based on a template? but templates are not associated to projectTypes,
I guess we could include them in the stack when its built? that could then limit them to specfic project types, and would be preferable over having them installed from npm anyway?
I’m just thinking through the scenarios of a user having 2 projects (small and medium) but they can’t communicate between them.
The ideal place from a user perspective is in the team tier I think, then you get it on all the projects that team has,
[nick]
Personally I think the nodes should be a CE feature
[nick]
… if they are a team tier thing, then we can’t ship them until we have team tiers
[nick]
or if it is a CE -vs- EE thing, then we need to add license checks into all the work I’ve done so far
[nick]
and move the code to the EE part of the code base
[Sam Machin]
I can see that trying to retrofit them to billing isn’t ideal, and we don’t have all the capabilities that we would need to do that right now anyway.
I’m just very aware that we’re still giving away all our value add at the lowest tiers which makes it harder to drive the higher revenue points….
[Sam Machin]
However from an FF cloud perspective I can see that these nodes make it more useful to have multiple projects (rather than several sets of flows in one) and that in turn would drive revenue
[Sam Machin]
Based on that lets keep these nodes as a CE feature, but it does highlight the importance of getting the billing and licensing frameworks into a ready state before we build more features
Summary, Inter-project Communications Nodes will be available to all Editions and Tiers.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
We discussed this at length in today's Product Review meeting and explored the available options.
The conclusion was to look at the feasibility of making this an EE-only feature (available to all teams/projects on an EE licensed platform).
I will scope out what it would take to make the product nodes covered by the EE license.
From a core code point of view there are two things the platform has to provide for the nodes to work:
We can find a way to only enable those things if EE is enabled.
We will update the stack install docs/scripts to include the nodes when building stacks. They will get installed regardless of CE/EE licensing
@ZJvandeWeg can this be closed now?
Epic
No response
Description
As a: Developer
I want to: Use a custom node to send messages to another gateway
So that: it can continue to process the data
Acceptance Criteria