Star

ThingsBoard Documentation

Documentation for using ThingsBoard IoT Platform.

Installing ThingsBoard Trendz Analytics on Ubuntu

Prerequisites

This guide describes how to install Trendz Analytics on Ubuntu Server 18.04 LTS.

Hardware requirements depend on amount of analyzed data and amount of devices connected to the system. To run Trendz Analytics on a single machine you will need at least 1Gb of free RAM.

In small and medium installations Trendz can be installed on the same server with ThingsBoard.

Step 1. Install Java 8 (OpenJDK)

ThingsBoard service is running on Java 8. Follow this instructions to install OpenJDK 8:

sudo apt update
sudo apt install openjdk-8-jdk

Please don’t forget to configure your operating system to use OpenJDK 8 by default. You can configure which version is the default using the following command:

sudo update-alternatives --config java

You can check the installation using the following command:

java -version

Expected command output is:

openjdk version "1.8.0_xxx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (build ...)

Step 2. Trendz Analytics service installation

Download installation package.

wget https://dist.thingsboard.io/trendz-1.4.1.deb

Install Trendz Analytics as a service

sudo dpkg -i trendz-1.4.1.deb

Step 3. Obtain and configure license key

We assume you have already have Trendz license key. If not, please get your Free Trial license before you proceed. See How-to get pay-as-you-go subscription for more details.

Once you get the license secret, you should put it to the trendz configuration file. Open the file for editing using the following command:

sudo nano /etc/trendz/conf/trendz.conf

Add the following lines to the configuration file and put your license secret:

# License secret obtained from ThingsBoard License Portal (https://license.thingsboard.io)
export TRENDZ_LICENSE_SECRET=YOUR_LICENSE_SECRET_HERE

Step 4. Configure connection with ThingsBoard Platform

You can connect Trendz Analytics to the ThingsBoard Community Edition or ThingsBoard Professional Edition.

Step 4.1 ThingsBoard Community Edition

Edit Trendz configuration file

sudo nano /etc/trendz/conf/trendz.conf

Add ThingsBoard REST API URL that would be used for communicating with ThingsBoard Platform

# ThingsBoard URL that will be used by Trendz
export TB_API_URL=http://localhost:8080
export TB_API_PE_ENABLED=false

Step 4.2 ThingsBoard Professional Edition

Edit ThingsBoard configuration file

sudo nano /etc/trendz/conf/trendz.conf

Add ThingsBoard REST API URL that would be used for communicating with ThingsBoard Platform

# ThingsBoard URL that will be used by Trendz
export TB_API_URL=http://localhost:8080
export TB_API_PE_ENABLED=true

Step 5. Run installation script

Once Trendz service is installed, you can execute the following script:

sudo /usr/share/trendz/bin/install/install.sh

Step 6. Start Trendz service

Execute the following command to start Trendz Analytics:

sudo service trendz start

Once started, you will be able to open Web UI using the following link:

http://localhost:8888/
Authentication

For first authentication you need to use Tenant Administrator credentials from your ThingsBoard

Trendz uses ThingsBoard as an authentication service. During first sign in ThingsBoard service should be also available to validate credentials.

Step 7. HTTPS configuration

You may want to configure HTTPS access using HAProxy. This is possible in case you are hosting Trendz in the cloud and have a valid DNS name assigned to your instance.

Step 7.1. Trendz and ThingsBoard hosted on same server

Use this section if HAProxy/Let’s Encrypt already installed in the server and HTTPS enabled for ThingsBoard.

Open HAProxy configuration file

sudo nano /etc/haproxy/haproxy.cfg

Locate frontend https_in section, add new access list that will match traffic by domain name and redirect this traffic to Trendz backend:

acl trendz_http hdr(host) -i new-trendz-domain.com
use_backend tb-trendz if trendz_http

In the same file register Trendz backend:

backend tb-trendz
  balance leastconn
  option tcp-check
  option log-health-checks
  server tbTrendz1 127.0.0.1:8888 check inter 5s
  http-request set-header X-Forwarded-Port %[dst_port]

Generate SSL certificates for new domain:

sudo certbot-certonly --domain new-trendz-domain.com --email some@email.io

Refresh HAProxy configuration:

sudo haproxy-refresh

That’s it, HTTPS for Trendz UI configured and now you can access it via: https://new-trendz-domain.com

Step 7.2. Fresh installation on new server

Please follow this guide to install HAProxy and generate valid SSL certificate using Let’s Encrypt.

Troubleshooting

Trendz logs are stored in the following directory:

/var/log/trendz

You can issue the following command in order to check if there are any errors on the backend side:

cat /var/log/trendz/trendz.log | grep ERROR