Installation
Install the Admin and Stream apps, connect them to PostgreSQL and start them.
Note: Total.js IoT Platform is available only with a Total.js Enterprise subscription. See the IoT Platform page on totaljs.com.
Total.js IoT Platform runs on your own server. You receive the source code from Total.js with your Enterprise license. The package has three folders:
admin: the app you work in.stream: the app that receives the data of your devices.drivers: example drivers that you can install or use as a starting point.
Requirements
- Node.js 18 or newer.
- PostgreSQL 15 or newer.
Create the database
Create an empty PostgreSQL database for the platform, for example iot. Both apps use this one database. Admin creates its tables the first time it starts.
Install Admin
- Open a terminal in the
adminfolder and install the dependencies:
npm install- Open the
configfile and set the connection to your database and the address where people will open the app:
database : postgresql://user:password@127.0.0.1:5432/iot
url : https://iot.example.com- Start the app:
npm startAdmin listens on port 8000. Open http://127.0.0.1:8000/ in your browser and continue with First steps.
Install Stream
- Open a terminal in the
streamfolder and install the dependencies:
npm install- Open the
configfile and set the same database and the public address of the stream. Your devices send their data to this address.
database : postgresql://user:password@127.0.0.1:5432/iot
url : https://stream.example.com- Open
index.jsand choose a port for the stream, different from the port of Admin. Remove the//in front of theoptions.portline and write the number:
options.port = 8001;- Start the stream:
node index.jsOpen http://127.0.0.1:8001/ to see the status page of the stream.
Run in production
Start each app in release mode, which is faster and does not watch the files for changes:
node index.js --releaseKeep both apps running with the process manager of your server and put them behind a web server with HTTPS. Devices must be able to reach the address of the stream. Admin only needs to be reachable by the people who use it, and by anyone who reads its open data.
All settings of both apps are described in Configuration files.