Total.js Platform
Total.js Platform

Total.js Platform news and tutorials

How to install OpenPlatform — IoT platform

This is a continuation of a series for the installation of the IoT platform. In the previous blog, we talked about how to install IoT platform application, stream application, OpenReports application, and Flow application and in this blog, we will continue with the installation of OpenPlatform application. This is the last part we need to install to make the whole IoT platform and then you can use all these apps together to get a great application to handle and analyze your data from diverse IoT devices.

If you haven’t heard about IoT platform or you want to get more information, please read this blog about the IoT platform first or watch this video describing the IoT platform. Please, keep in mind, that this platform is part of Total.js enterprise.

Why do you need OpenPlatform?

As with OpenReports and Flow, it is not necessary to use OpenPlatform in the IoT platform, but it enhances possibilities for various cases. We will integrate here IoT platform application, OpenReports application, and Flow application for easier access to all of them. This will make feeling, that all of these apps are one system and we will be able to create access for our users, manage their permissions, or add new modules to our app.

What is OpenPlatform?

OpenPlatform is a portal for running, integrating, and managing multiple 3rd party web applications. It includes user authentication and permissions management for connected applications.

Installation of OpenPlatform

We will continue with the assumption, that you followed the previous blogs about IoT platform, stream, OpenReports, and Flow, but this tutorial does not depend on it. So you can install OpenPlatfoem based on this blog and use it also for other cases.

Download source code and install dependencies

First, we have to download an application from a GitHub repository and save it to a directory. We can do it via the terminal with the code:

We installed all dependencies in the previous tutorial, but if you are new here, just follow your terminal console or review previous blog posts.

Update port

We run the IoT platform, stream, and Open Reports on ports 8000, 8001, and 8002, so we have to go to the index.js file and change port to another, in this case, we will set it to port 8004.

This is how our index.js can look:

Update the config with a connection string to the database

OpenPlatform needs to create a database, so we have to go to the config file and update their connection string. We will add the same connection string as for our application because OpenPlatform will create a new schema in this database with its own architecture. But if you want to split these two databases and have your own database for every app, you can do it too. The updated config file can look like this:

Updated config file

Now we can run the application by terminal command:

Run OpenPlatform

Now our application is running on port 8004 and we can access it via a web browser.

When we want to log in to the application for the first time, we have to use default credentials, which are:

You can find them in the readme file in the GitHub repository of the OpenPlatform.

First login into the OpenPlatform

It is highly recommended to change your credentials after the first login.

Adding an applications

As the first application, we can add an IoT platform. This approach will be the same as for other applications, so we will be more detailed here and the next applications will be only a quicker process.

Adding an IoT platform application to OpenPlatform

When we have already prepared our IoT platform app, we have to go to the Settings section. There is already a part dedicated to OpenPlatform with prepared inputs for request and response tokens and also an Importing link to OpenPlatform. First, we have to copy this link and put it into the OpenPlatform Apps section, where we can find the Import form.

Importing IoT platform application to OpenPlatform

After importing an application a form will appear, where you can see some very important information, like name, request and response token, and permissions.

I will change the name to IoT, and then we have to copy the request and response token to the previously mentioned inputs in the IoT platform Settings section and save our Import in the OpenPlatform application.

Importing IoT platform application to OpenPlatform

Now is IoT platform application imported into OpenPlatform, but we have to give access to users to this application in OpenPlatform. For this, we have to go to the Groups section, there is right now just one group (you can create more and add new users to particular groups) and that is Admin. We will click on this group, check the IoT platform application as an allowed app (as you can see there, you can allow access not only to the full application, but also just for particular plugins as you choose), and save a form. Then after refreshing the OpenPlatform app, the IoT platform will appear there and we can access it through OpenPlatform.

Allowing access to IoT platform application for Admin group in OpenPlatform

Adding of an OpenReports and Flow applications to OpenPlatform

We can use the same process for importing the OpenReports application and Flow application. Both of them have an OpenPlatform part in the Settings section with an Importing link and inputs for request and response tokens.

Then we have to add permissions to these applications to group Admins in the OpenPlatform and then we can access them through the OpenPlatform application.

Imported applications in OpenPlatform

The only application, that we do not import here is stream application because this is just for receiving data for sensors.

Conclusion

That is all for this blog. Now you are able to install IoT platform, stream, OpenReports, Flow, and OpenPlatform with importing applications. There is a lot more that you can achieve with this application, but this was just a simple explanation of how to install it and start using it.

I hope you learned something new with this blog and I will happily share with you more knowledge about Total.js.

Video