Step 5: Install the ThingsBoard* Reference#

This ThingsBoard* reference includes a pre-configured database customized for Intel’s EI for AMR solution.

Configure ThingsBoard*#

Do all steps on the control plane.

  1. Log in as root. Do all steps as root.

    sudo su -
    
  2. Import the repository signing key:

    wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
    
  3. Add the repository contents to your system:

    RELEASE=$(lsb_release -cs)
    echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list
    
  4. Install and launch the postgresql service:

    apt update
    apt -y install postgresql-12
    service postgresql start
    
  5. Set the password for postgres:

    su - postgres
    psql
    \password
    

    You are asked to set a password here, set postgres.

    \q
    exit
    
  6. Create the .mytb-data and .mytb-logs directories:

    mkdir -p ~/.mytb-data && chown -R 799:799 ~/.mytb-data
    mkdir -p ~/.mytb-logs && chown -R 799:799 ~/.mytb-logs
    
  7. Generate a key pair for ThingsBoard* to EI for AMR robot communications. Run script using the control plane server hostname and IP as input parameters:

    cd <edge_insights_for_amr_path>/Edge_Insights_for_Autonomous_Mobile_Robots_<version>/AMR_server_containers
    chmod +x 01_docker_sdk_env/artifacts/02_edge_server/edge_server_fleet_management/thingsboard/tb-key-gen.sh
    ./01_docker_sdk_env/artifacts/02_edge_server/edge_server_fleet_management/thingsboard/tb-key-gen.sh <TB-Hostname> <TB-IP>
    
  8. Copy the keys to the SFTP server. If the SFTP server is not configured, see Step 2: SFTP Server Setup.

    sftp fdo_sftp@<sftp_server_ip>
    cd /fdo_sftp/
    lcd <AMR_Server_Containers>/01_docker_sdk_env/artifacts/02_edge_server/edge_server_fleet_management/thingsboard/
    put thingsboard.pub.pem
    exit
    

Install the ThingsBoard* Reference#

On the control plane, build the ThingsBoard* and install the playbook:

source ./01_docker_sdk_env/docker_compose/common/docker_compose.source
export DISPLAY=0:0
chmod 775 -R 01_docker_sdk_env/artifacts/02_edge_server/edge_server_fleet_management/preconfigured_tb_server_database/db
docker compose -f 01_docker_sdk_env/docker_compose/02_edge_server/edge-server.all.yml build fleet-management
ansible-playbook 01_docker_sdk_env/docker_orchestration/ansible-playbooks/02_edge_server/fleet_management/fleet_management_playbook_install.yaml

If the playbook fails to install, see Troubleshooting.

Check the ThingsBoard* Reference Installation#

  1. On the control plane, verify that the services, pods, and deployment are running:

    $ kubectl get all --output=wide --namespace fleet-management
    NAME                                          READY   STATUS    RESTARTS      AGE
    pod/fleet-deployment-8449fdc54f-m4fhb         1/1     Running   2 (21s ago)   81s
    
    NAME                                          TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                       AGE
    service/fleet-service                         NodePort   10.97.216.230   <none>        9090:32764/TCP,1883:32765/TCP,7070:32766/TCP,8883:32767/TCP   42s
    
    NAME                                          READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/fleet-deployment              1/1     1            1           81s
    
    NAME                                          DESIRED   CURRENT   READY   AGE
    replicaset.apps/fleet-deployment-8449fdc54f   1         1         1       81s
    

    If they are not running, see Troubleshooting.

  2. On each edge node, verify that the Docker* container is running:

    docker ps | grep fleet
    dd22be830f82   10.237.23.152:30003/intel/fleet-management               "/usr/bin/start-tb.sh"   52 minutes ago   Up 52 minutes             k8s_fleet_fleet-deployment-858494f866-7jmhh_fleet-management_13d09334-4223-4409-8cd9-c0cac60cd04c_0
    

    If the container was not deployed, see Troubleshooting.

Open the ThingsBoard* Reference#

  1. ThingsBoard* runs on the control plane, but it can be accessed from any machine on the same network by:

    # Open Firefox and go to:
    <control plane IP Address>:32764
    

    Warning

    Installing VNC on the control plane node breaks the Intel® Smart Edge Open installation. Intel® recommends that you access ThingsBoard* on the control plane without VNC or from any other system in the same network.

    Expected result: A ThingsBoard* login interface appears.

    Warning

    If the ThingsBoard* login interface does not appear, set your browser settings to No Proxy. If the ThingsBoard* login interface still does not appear, see Troubleshooting.

Troubleshooting#

  • If the playbook does not install, or the services, pods, or deployment are not running, first check if the installation was successful even if ansible-playbook failed.

    If the installation was unsuccessful, uninstall and reinstall the playbook.

    ansible-playbook AMR_server_containers/01_docker_sdk_env/docker_orchestration/ansible-playbooks/02_edge_server/fleet_management/fleet_management_playbook_uninstall.yaml
    ansible-playbook AMR_server_containers/01_docker_sdk_env/docker_orchestration/ansible-playbooks/02_edge_server/fleet_management/fleet_management_playbook_install.yaml
    

    If the ThingsBoard* login interface does not appear, check if your network blocks certain ports. ThingsBoard* uses port 9090. Intel® Smart Edge Open maps this port on the control plane to 32764.

    To get more details on what ports and IPs are used:

    kubectl describe node | grep 'Addresses:' -A 4 | grep -B1 $(kubectl get nodes | grep control-plane | awk '{print $1}') | grep InternalIP | awk '{print $2}'
    

    For detailed EI for AMR target installation steps, see the Get Started Guide for Robots.

  • To perform the switch to the preconfigured database, use the following commands:

    docker exec -it <container-id-of-edge-fleet-management> bash
    ./tb-server-reset-db.sh
    exit
    docker restart <container-id-of-edge-fleet-management>
    
  • The container might restart several times. If is restarting more than 10 minutes continuously, uninstall and reinstall the playbook.

    If the error persist, recreate the two database directories from the above steps.

    sudo su -
    ansible-playbook AMR_server_containers/01_docker_sdk_env/docker_orchestration/ansible-playbooks/02_edge_server/fleet_management/fleet_management_playbook_uninstall.yaml
    service postgresql restart
    rm -rf ~/.mytb-data && mkdir -p ~/.mytb-data && chown -R 799:799 ~/.mytb-data
    rm -rf ~/.mytb-logs && mkdir -p ~/.mytb-logs && chown -R 799:799 ~/.mytb-logs
    ansible-playbook AMR_server_containers/01_docker_sdk_env/docker_orchestration/ansible-playbooks/02_edge_server/fleet_management/fleet_management_playbook_install.yaml