Add-Ons

Adding components to the Streamsheets architecture is possible. These can be Streamsheets specific plugins like OpenID or general usuful additions to your IoT architecture like databases.

Open ID Connect#

OpenID Connect is a professional feature star

Streamsheets allows the coupling of existing user bases to your Streamsheets installation by using OpenID Connect. OpenID Connect is an open standard and decentralized authentication protocol on top of OAuth 2.0. It allows clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner. To get more information on OpenID click here.

OpenID in Streamsheets#

OpenID Connect is available as a separate professional plugin and not part of the standard professional image. After activating this plugin, users are automatically created on the first sign-in. The initial role and workspace for new users can be configured via environment variables. To use this plugin, put the "openid" plugin folder into the streamsheets directory and add the required configuration in the docker-compose.yml:

  • Create a "plugins" directory in your streamsheets installation directory (i.e. ./streamsheets/plugins)
  • Put the "openid" directory into the ./streamsheets/plugins directory.
  • Run npm install in the "openid" plugin directory.
  • Add the following volume and environment variables to the docker-compose.yml:
streamsheets:
...
volumes:
...
./streamsheets/plugins/openid:/streamsheets/plugins/openid
environment:
...
# URL of the issuer
STREAMSHEETS_OPENID_ISSUER_URL: '<ISSUER_URL>'
# Client ID provided by the issuer
STREAMSHEETS_OPENID_CLIENT_ID: '<CLIENT_ID>'
# Client Secret provided by the issuer
STREAMSHEETS_OPENID_CLIENT_SECRET: '<CLIENT_SECRET>'
# Streamsheets host, e.g 'https://streamsheets.example.org' or `http://localhost:8080`
STREAMSHEETS_HOST: '<STREAMSHEETS_HOST>'
# Make OpenID the default auth mechanism
STREAMSHEETS_DEFAULT_AUTH_MECHANISM: 'openid'

Additional Configuration of the Plugin#

The following environment variables can be set to configure how users are handled the first time they sign into streamsheets via OpenID Connect.

  • STREAMSHEETS_OPENID_INITIAL_ADMIN, default false. If true, all new users have full administrative rights.
  • STREAMSHEETS_OPENID_INITIAL_WORKSPACE. If set to a workspace ID, the user is automatically added to the workspace and is assigned the role specified by STREAMSHEETS_OPENID_INITIAL_ROLE.
  • STREAMSHEETS_OPENID_INITIAL_ROLE, default viewer, allowed values viewer, developer. The role a user is assigned in the workspace specified by STREAMSHEETS_OPENID_INITIAL_WORKSPACE.
info

The Streamsheets login page is still reachable by navigating to {baseURL}/login?provider=local.

Configuration at the Issuer#

Streamsheets requires the following configuration parameters to be set:

  • Scope: openid user
  • Callback URL: <STREAMSHEETS_HOST>/openid/callback

MongoDB#

Streamsheets come with the option to connect to any MongoDB you need. If you don´t have a MongoDB yet, it is fairly simple to setup. While Streamsheets run with docker, the same possibility exists for MongoDB.

Setup Mongo Database

Open a terminal of your choice and enter:

Command: docker run --name <container-name> --net streamsheets mongo
Example: docker run --name mymongodb --net streamsheets mongo

If you have the Raspberry Pi version use:

Command: sudo docker run --name <container-name> --net streamsheets andresvidal/rpi3-mongodb3
Example: sudo docker run --name mymongodb --net streamsheets andresvidal/rpi3-mongodb3

This command downloads a MongoDB image and runs it in a container named container-name in the docker network “streamsheets”. It is important that the container name does not contain capital letters!

Now you can create a new MongoDB Connector in the Administration Menu of your Streamsheet installation. Check the “External Host” checkbox and enter the container-name under “Host(s)”. All other settings are optional. Add a Producer and use the MONGO.STORE function to safe your first datapoints to your very own MongoDB.

Start Stop MongoDB

To properly stop and start your created container enter:

Command: docker stop <container-name> docker start <container-name>
Example: docker stop mymongodb docker start mymongodb

Further Settings

You can add these commands to the docker run command above.

CommandDescription
-publish 27017:27017set the MongoDB port to 27017
-e MONGO_INITDB_ROOT_USERNAME=mongoadminadds root user
-e MONGO_INITDB_ROOT_PASSWORD=secretadds root password
-v ./<directory>:/data/dbadd the container data to a folder outside of the docker environment. (change <directory> to a real path)

More can be found here.