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

Plugin mechanism #105

Merged
merged 38 commits into from
Nov 13, 2016
Merged

Plugin mechanism #105

merged 38 commits into from
Nov 13, 2016

Conversation

tkurki
Copy link
Member

@tkurki tkurki commented Oct 1, 2016

A plugin mechanism should allow extending the server's functionalities. Some examples:

  • derived data: calculate value X based on some other values and include the derived data in the SK outputs
  • conversion and output to 0183/N2K:
    • create 0183 autopilot data and send it to connected tillerpilot
    • convert AIS data from connected 0183 ais receiver to N2K
  • integration to external services: for example send location to MarineTraffic
  • logging: write all numeric data to

A plugin needs access to

  • SK input stream and full model data
  • 0183 and N2K input streams
  • SK output stream & full model
  • all outputs (I2C, 0183, N2K, etc)
  • configuration data persistence
  • configuration data editing

Plugins should be installed independently, allowing independent versioning & dependencies.

There should be a standard plugin configuration UI.

@tkurki
Copy link
Member Author

tkurki commented Oct 1, 2016

I've been thinking that configuration could be based on JSON schema and the UI & data model would be dynamically generated.

The server would get a JSON schema for the configuration UI via plugin API and create the UI using for example https://github.com/mozilla-services/react-jsonschema-form. The server would take care of saving & retrieving the configuration data and plugin lifecycle.

@tkurki
Copy link
Member Author

tkurki commented Oct 1, 2016

My current idea is that plugins would be independent npm modules, installed as usual with npm install, but with a certain keyword in package.json identifying them as SK Node server plugins. The server can list the installed plugins based on this keyword.

@tkurki
Copy link
Member Author

tkurki commented Oct 1, 2016

The configuration UI could be browser-only, with no server side html generation apart from initial bootstrap.

The UI would use server's REST api to retrieve & store per plugin configuration data. This part of the architecture could be part of the shared SK spec.

@tkurki
Copy link
Member Author

tkurki commented Oct 1, 2016

During sailing season 2016 I had the following server side pluginish functionalities

  • raw data logging (hourly files) with sync to S3
  • SK data to pgn 129039 (AIS dynamic data)
  • SK heading to pgn 127250
  • SK data to MWV, RMC, APB
  • SK data to InfluxDB
  • SK data to MarineTraffic position report (AIS)

My plan is to turn these into plugins and eat this PRs dogfood with them.

@tkurki
Copy link
Member Author

tkurki commented Oct 8, 2016

#102 could be another plugin.

@tkurki
Copy link
Member Author

tkurki commented Oct 17, 2016

Capability to intercept and capture the data the server is passing out would be useful.

For example primary + backup: send data from backup source only if data from primary source is not available.

@tkurki
Copy link
Member Author

tkurki commented Oct 30, 2016

  • add server's index and demote bower plugins one level down
  • documentation
  • server-driven enable/disable mechanism
  • add conversion example
  • package set-system-time
  • add zones editor
  • fetch polyfill
  • add bundle

@joabakk
Copy link
Contributor

joabakk commented Nov 3, 2016

This is a really good initiative and should be able to cover many needs/requests. With good documentation and examples how to develop own plugins, we could have ourself an app store.

@tkurki
Copy link
Member Author

tkurki commented Nov 3, 2016

@joabakk if you have the time it would be really great if you could try the plugins branch and possibly try to create your own plugin. See one of the plugins added in 91f0ab5 for examples.

@joabakk
Copy link
Contributor

joabakk commented Nov 5, 2016

I'm looking into it. But as far as I can see, none of these plugins are published on npm and npm update does not add these to my server. Would it be possible to make another example that takes sk data, does some calculation and sends back sk to the server? It could well be empty for me to fill in the paths.

Ideas for plugins:

  • Calculate propeller slip
  • Look up polar and target speeds from db
  • Generate seatalk datagrams to be sent as $STALK sentences

@tkurki
Copy link
Member Author

tkurki commented Nov 7, 2016

Ready for merging - I would appreciate any and all feedback. In case somebody bites: start from Readme.

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="/bower_components/jquery/dist/jquery.min.js"</script>
Copy link
Contributor

Choose a reason for hiding this comment

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

missing >

<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

<script src="main.js"></script>

Copy link
Contributor

Choose a reason for hiding this comment

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

main.js is found in developer tools, but not on the webpage

@tkurki
Copy link
Member Author

tkurki commented Nov 12, 2016

I believe this is ready for merging.

@sbender9
Copy link
Member

It would be nice to be able to do a quick check to see if a specific plugin is installed and enabled. I currently have to get the config for all of the plugins and go through them.

@tkurki
Copy link
Member Author

tkurki commented Nov 13, 2016

@sbender9 you mean via http / rest?

@tkurki
Copy link
Member Author

tkurki commented Nov 13, 2016

See 4368588

@sbender9
Copy link
Member

Yep. Perfect. Thanks!

@tkurki tkurki merged commit 46093b7 into master Nov 13, 2016
@tkurki tkurki deleted the plugins branch November 19, 2016 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants