-
Notifications
You must be signed in to change notification settings - Fork 0
Design: Version Control
When we talk about version control of node-red instances, there are two things that it covers:
- the nodes added to the environment via npm
- the deployed flows (+credentials)
It is desirable to have a single artefact (or logical set of artefacts) that can be maintained in version control and used to restore a system to a previous known state.
Currently, a user simply npm installs nodes in their user directory to add them to the runtime - or uses the admin api to do so. There is no requirement to maintain a package.json file. But it is that file that needs to be version controlled in order to have a restorable system.
This raises some questions:
- should we try to create/maintain a package.json file under the user directory - in much the same way that
npm install --savedoes. - should we do this via the Storage API so alternative (non-filesystem) based solutions can make use of it
Use cases include:
- a user creates a new version of the flows by simply clicking deploy
- a user can optionally add a comment to the version
- a user can see a history of versions - showing date/time + comment (aka
git log) - a user can load a previous version into the editor, which, if then deployed becomes a new version
Whilst clearly influenced by git as a likely common backend, the version control API needs to be careful to abstract the operations it provides sufficiently so that alternative VC systems can be used underneath it. It does not require the full breadth of capability that git provides (branching/merging etc).
The basic operations are:
- get a version - defaults to the most recent version, but a version id can also be specified
- save a new version of flows/credentials with an optional description. This returns a version id.
- get the version history - returns a list of id/user/timestamp/description
The API should also allow a 'user' identified to passed to each of these calls.