Set Up ThingsBoard* Cloud Data
To access the cloud data feature, you need to create a cloud ThingsBoard* server using your AWS Elastic Compute Cloud version 2 Instance machine that will provide the possibility to have application monitoring dashboard.
The reference implementations can connect with the ThingsBoard service to send data such as alerts, Driver’s drowsiness, driver name or driving mode.
If you have done the AWS S3 Bucket setup you will be able to see and play the videos uploaded by the Reference Implementation.
At the end of the setup you will have Thingsboard_Access_Token, Thingsboard_link_or_ip and Thingsboard_port to be used on on your Edge Insights for Fleet Reference Implementation Cloud Data - Configuration.
To enable this feature you will need to install the package on your machine or on local area network machine.
Set up AWS EC2 Instance
Login on the AWS console and search the EC2 service:
Click on the Launch instances button to create a new EC2 instance:
Search and select an instance with Ubuntu 20.04:
Select an instance with 2GB RAM:
Enable auto-assign public IP:
Assign a storage size:
Configure a security group and add port 8080 TCP in Inbound Rules in the Security Group of cloud instance. It can also be configured when the instance is created.
Review the instance and launch it:
Download your access file. Save it on your working environment with the name access.pem. It will not be possible to download it later.
After a few minutes, the instance will be generated.
Go back to the EC2 panel. The instance state will be Running.
Installation
Connect to the AWS EC2 instance using ssh and the key you have saved:
ssh -i "your_key.pem" ubuntu@your_ec2_instance_dns_link
Configure the Ubuntu machine by running the following commands:
sudo apt-get update && sudo apt-get upgrade
Install Docker and Docker Compose.
Get gpg key for docker binaries and add the apt repository to your apt source list.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor-o/usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
From the ssh terminal window, create a folder called thingsboard:
mkdir thingsboard
Change directory to thingsboard:
cd thingsboard
Using your preferred file editor, create a file called docker-compose.yml and add the following contents:
version: '2.2' services: mytb: restart: always image: "thingsboard/tb-postgres" ports: - "8080:9090" - "1883:1883" - "31000:7070" - "5683-5688:5683-5688/udp" - "31001:5432" environment: TB_QUEUE_TYPE: in-memory SSL_ENABLED: "true" SSL_CREDENTIALS_TYPE: "PEM" SSL_PEM_CERT: /config/server.pem SSL_PEM_KEY: /config/server_key.pem SSL_PEM_KEY_PASSWORD: secret volumes: - ~/.mytb-data:/data - ~/.mytb-logs:/var/log/thingsboard - ~/.mytb-config:/config
Create folders for the ThingsBoard database and logs:
mkdir ~/.mytb-data mkdir ~/.mytb-logs mkdir ~/.mytb-config
Change user and group permissions to let ThingsBoard access those two folders:
sudo chown 799:799 ~/.mytb-data sudo chown 799:799 ~/.mytb-logs sudo chown 799:799 ~/.mytb-config
Generate self-signed certificates to enable the ThingsBoard https feature:
# Generate Certificate openssl ecparam -out server_key.pem -name prime256v1 -genkey # Generate the key for the certificate openssl req -new -key server_key.pem -x509 -nodes -days 365 -out server.pem
Copy the files to the .mytb-config folder:
sudo cp server*.pem ~/.mytb-config/
Pull the Docker Hub image with the command: (If your user is not in a Docker group, use sudo in the command.)
docker-compose -f docker-compose.yml pull
Start the ThingsBoard server with the command:
docker-compose -f docker-compose.yml up -d
In about 2-3 minutes, you should be able to access the ThingsBoard page.
Go to your preferred browser and access: https://<aws_ec2_dns>:8080/login
Due to the self-signed certificate, a warning will occur from your preferred browser. Click on Advanced and click to view certificate. Download it locally and accept the connection.
Copy the downloaded certificate to Edge Insights for Fleet local storage using the following command:
sudo cp <your_pem_file>.pem /opt/intel/eii/local_storage/server_pub_tb.pem
Log in with the default user and password set up by the public Docker image:
User: tenant@thingsboard.org Password: tenant
ThingsBoard* Cloud Setup
Devices and device profile setup:
First we need to create the Device and Device Profile.
Open the Devices tab from the main page or from the list on the left.
Click on + and then click on Add new device.
A pop-up window with Add new device title is displayed.
If this is the first device, select Create new device profile.
Enter the Device name using the format Vehicle <Name>, where <Name> is user-defined.
NOTE:Make sure that the Device profile name includes fleet, for example: fleet1 or fleet.
Click on Credentials to open the Credentials tab.
Click on Add credentials options.
Set up a token for this device. Save this token to use on the Reference Implementations you have installed on the Cloud Data -> Configuration tab.
Click on Add to finish.
Create your ThingsBoard* Environment
This setup will provide the steps to import the templates required for your ThingsBoard Cloud Setup.
If you have the AWS* Cloud Storage setup, you should complete the Cloud Data -> Configuration in order to have your Thingsboard Server connected with AWS. This allows access to multimedia files (videos or snapshots) uploaded by the Reference Implementation on your AWS S3 Bucket server.
Open the Rule Chains page from the main page or from the list on the left.
Click on + and select Import rule chain.
A pop-up window will appear to drop the json file or click to select the file.
Click on the area and in your installation folder, go to the following path:
<install_path>/<package_name>/<package_name><version>/<use_case_folder>/src/Dashboard/imports/
For example:
/home/intel/driver_behavior_analytics/Driver_Behavior_Analytics_2021.4/Driver_Behavior_Analytics/EII-DriverBehavior-UseCase/src/Dashboard/imports/
Select the 1-RuleChain.json file and click on the Import button.
Click on the Verified mark button to acknowledge the rule chain.
Click on the Widgets Library tab button.
Click on + and select Import widgets bundle.
A pop-up window will appear to drop the json file or click to select the file.
Click on the area and in your installation folder, go to the following path:
<install_path>/<package_name>/<package_name><version>/<use_case_folder>/src/Dashboard/imports/
For example:
/home/intel/driver_behavior_analytics/Driver_Behavior_Analytics_2021.4/Driver_Behavior_Analytics/EII-DriverBehavior-UseCase/src/Dashboard/imports/
Select the 2-WidgetsA-intel_fleet_widgets.json file and click on the Import button.
Select the 3-WidgetsB-intel_manageability_widgets_new_3_x_version.json file and click on the Import button.
Open the Dashboards page from the main page or from the list on the left.
Click on + and select Import Dashboard.
A pop-up window will appear to drop the json file or click to select the file.
Click on the area and in your installation folder, go to the following path:
<install_path>/<package_name>/<package_name><version>/<use_case_folder>/src/webui/templates
For example:
/home/intel/driver_behavior_analytics/Driver_Behavior_Analytics_2021.3/Driver_Behavior_Analytics/EII-DriverBehavior-UseCase/src/webui/templates/
Select the 5-Dashboard-v2.json file and click on the Import button.
The Intel Fleet Manager Dashboard should be visible on your dashboards list.
To open a dashboard, click on the following icon:
Your dashboard should automatically map the vehicle device you have previously created. To activate the Reference Implementation monitoring, you will need to complete the Cloud Data -> Configuration and Run the Use Case.
On the dashboard, click on the device you configured for your Reference Implementation.
For example, if you added the Vehicle A access token to your RI and you started the use case, then click on Vehicle A inside the dashboard in order to open the vehicle page that will provide the detection data and the simulated data live.
Troubleshooting
If you don’t have access to the ThingsBoard web page, you may need to change the port forwarding inside the docker-compose.yml file.
Follow these steps:
Run the following command to stop ThingsBoard server:
docker-compose -f docker-compose.yml down
Modify the docker-compose.yml file with your port forwarding setup. The left side ports are used on your host.
- "8080:9090" - "1883:1883" - "7070:7070" - "5683-5688:5683-5688/udp" - "30000:5432"
For example, if port 8080 is blocked, your new port forwarding configuration for this port could be:
- "30300:9090"
The server will access 8080 port inside the Docker container and it will forward the data to port 30300 on your host machine.
Save the file and re-run the command to start the server:
docker-compose -f docker-compose.yml up -d