Get Started Guide

  • 2022.3
  • 10/23/2022
  • Public Content

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

  1. Login on the AWS console and search the EC2 service:
    A window showing the AWS console with search results for EC2.



  2. Click on the
    Launch instances
    button to create a new EC2 instance:



  3. Search and select an instance with Ubuntu 20.04:



  4. Select an instance with 2GB RAM:



  5. Enable auto-assign public IP:



  6. Assign a storage size:



  7. 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.



  8. Review the instance and launch it:



  9. Download your access file. Save it on your working environment with the name
    access.pem
    . It will not be possible to download it later.



  10. After a few minutes, the instance will be generated.
Go back to the EC2 panel. The instance state will be Running.

Installation

  1. 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
  2. Configure the Ubuntu machine by running the following commands:
    sudo apt-get update && sudo apt-get upgrade
  3. 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
  4. From the ssh terminal window, create a folder called
    thingsboard
    :
    mkdir thingsboard
  5. Change directory to
    thingsboard
    :
    cd thingsboard
  6. 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
  7. Create folders for the ThingsBoard database and logs:
    mkdir ~/.mytb-data mkdir ~/.mytb-logs mkdir ~/.mytb-config
  8. 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
  9. 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



  10. Copy the files to the
    .mytb-config
    folder:
    sudo cp server*.pem ~/.mytb-config/
  11. 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
  12. Start the ThingsBoard server with the command:
    docker-compose -f docker-compose.yml up -d
  13. In about 2-3 minutes, you should be able to access the ThingsBoard page.
    1. Go to your preferred browser and access:
      https://<aws_ec2_dns>:8080/login
    2. 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.
    3. 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
    4. 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:
  1. First we need to create the Device and Device Profile.
  2. Open the
    Devices
    tab from the main page or from the list on the left.



  3. Click on
    +
    and then click on
    Add new device
    .
  4. A pop-up window with
    Add new device
    title is displayed.
  5. 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.
    Make sure that the Device profile name includes
    fleet
    , for example:
    fleet1
    or
    fleet
    .



  6. Click on
    Credentials
    to open the Credentials tab.
  7. Click on
    Add credentials options
    .
  8. 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.
  9. Click on
    Add
    to finish.
If you want to have multiple
Vehicle
devices for Edge Insights for Fleet Reference Implementations, you just need to create a new one, assign the
fleet
device profile to it and set an access token.

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.
  1. Open the
    Rule Chains
    page from the main page or from the list on the left.
  2. Click on
    +
    and select
    Import rule chain
    .
  3. A pop-up window will appear to drop the json file or click to select the file.
  4. 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/
  5. Select the
    1-RuleChain.json
    file and click on the
    Import
    button.
  6. Click on the
    Verified mark
    button to acknowledge the rule chain.



  7. Click on the
    Widgets Library
    tab button.
  8. Click on
    +
    and select
    Import widgets bundle
    .
  9. A pop-up window will appear to drop the json file or click to select the file.
  10. 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/
  11. Select the
    2-WidgetsA-intel_fleet_widgets.json
    file and click on the
    Import
    button.
  12. Select the
    3-WidgetsB-intel_manageability_widgets_new_3_x_version.json
    file and click on the
    Import
    button.



  13. Open the
    Dashboards
    page from the main page or from the list on the left.
  14. Click on
    +
    and select
    Import Dashboard
    .



  15. A pop-up window will appear to drop the json file or click to select the file.
  16. 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/
  17. Select the
    5-Dashboard-v2.json
    file and click on the
    Import
    button.
  18. The Intel Fleet Manager Dashboard should be visible on your dashboards list.
  19. To open a dashboard, click on the following icon:



  20. 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
    .



  21. 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:
  1. Run the following command to stop ThingsBoard server:
    docker-compose -f docker-compose.yml down
  2. 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.
  3. Save the file and re-run the command to start the server:
    docker-compose -f docker-compose.yml up -d

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.