Master node
Using the master node
In general, the master node will be a cloud server or similar that you have as part of your network. The master node is responsible for authenticating new devices, provisisioning them, and holding records for all tracked database tables.
Authenticating devices
The master node is responsible for issuing JWT tokens to all new devices entering the network, and refreshing expired tokens.
When started, it will present an HTTP endpoint /authenticate which nodes will attempt to connect to to be issued a JWT. You will need to implement this endpoint, however Bruinen can also help with implementation. We also have prebuilt implementations for Username/Password, OAuth, and basic API key authentication.
Once a JWT has been issued, it will be used by the node to connect back to the master node as well as to peer nodes.
Provisioning
When a device is first set up, or has been offline for a long time, it needs to be provisioned. This means it needs to initial “state of the world” according to the database.
When a device first connects and receives an auth token, it will immediately ask the master node for any tables it cares about. The master node will provide the most recent version of this data that it has seen to the node.
Authoratative recordkeeper
The master node is required to hold all tables within the database (i.e. it cannot be a partial replica), this enables it to provision new devices.
Device discovery
The master node can also be responsible for device discovery (though this is optional), if configured this way, it will hold a record of “where” each device in the network can be found, so that other devices may connect directly with their peers.