Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Background Color
color#F5F5F5

Introduction

Device Manager is an application to manage different devices by fetching the device details, adding devices, adding device groups, managing device reservations etc.

This document provides the deployment steps for setting up Device Manager server and all its dependencies.

For setting up this server the below applications or tools should be available in the server machine:

  1. JDK – 1.817
  2. TOMCAT – v8v9.50.xx
  3. MAVEN – v3.8 or above
  4. MariaDB – v10.11MySQL DB – v5.6
Background Color
color#F5F5F5

Prerequisites

The below software should be installed and available for running Device Manager server.

If you already have an existing setup of Automatics you can follow the steps in this page for upgrading the software's Automatics Technology Stack - Upgrade 

Software Requirement

  • JDK 17

Please note that even though the recommended version of Orchestration is JDK17, it is reverse compatible with JDK11 also. So code also be compiled with JDK11. Follow Steps below to install Java 17 on CentOS/linux.

MySQL DB

Check whether My SQL DB is already installed and up and running.  For installation of MySQL in the below OS refer the below links

Jdk – 1.8

JDK should be available in the build machine where the .war file for Device Manager server is build and it should be available in the server machine.

Tomcat – 8 - Ver above v8.5

Tomcast 8 is required to deploy Device Manager server. Tomcat server installation file and setup documents can be found in the below links:

  • Download: https://tomcat.apache.org/download-80.cgi
      • Update before installing any new program
    Code Block
    languagebash
    sudo yum -y update
      • Install Java 17
    Code Block
    languagebash
    sudo yum install java-17-openjdk
      • Verify Java is Installed
    Code Block
    languagebash
    java -version


    Sample output:

    Image Added

    • MariaDB 10.11

    Follow below steps to install and configure MariaDB on CentOS/linux

      • All the packages need to be up-to-date. Use the following command to update your packages.

        Code Block
        languagebash
        sudo yum update

        Create a new repo file for the latest version.

        Code Block
        languagebash
        vi /etc/yum.repos.d/MariaDB.repo

        Copy and paste the following contents into the /etc/yum.repos.d/mariadb.repo file.

        Code Block
        [mariadb]
        name = MariaDB
        baseurl = http://yum.mariadb.org/10.11/centos7-amd64
        gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
        gpgcheck=1

        To exit and save the Vim file, type :wq and press Enter.

      • Install the Latest Version of MariaDB

    Install 10.11 of MariaDB and the most common packages, using the command below.

    Code Block
    languagebash
    sudo yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
      • Start MariaDB

        Start the MariaDB service with this command.

        Code Block
        languagebash
        sudo systemctl start mariadb

        To set MariaDB to start automatically when the VM boots up, use the following command.

        Code Block
        languagebash
        sudo systemctl enable mariadb

        Check the current status of MariaDB using this command.

        Code Block
        languagebash
        sudo systemctl status mariadb

        Check the currently installed MariaDB version with this command.

        Code Block
        languagebash
        sudo mysql -u root -p -V
    • Tomcat 9.0.XX

    Follow below Steps to setup Tomcat server  on CentOs/linux.

    Code Block
    languagebash
    wget -c https://downloads.apache.org/tomcat/tomcat-9/v9.0.85/bin/apache-tomcat-9.0.85.tar.gz
      • Extract the Tomcat archive to the directory in which you want to deploy the Automatics Tools
        Code Block
        languagebash
        sudo tar -xvf apache-tomcat-9.0.85.tar.gz -C /opt/automatics/
      • Navigate to the tomcat file path and run ./bin/startup.sh cmd to start the tomcat server.

    Sample Output:

    Image Added

    Setup: https://tomcat.apache.org/tomcat-8.5-doc/setup.html


    Maven – 3

    Maven is the tool used for building and managing Device Manager project. Please follow the below links to download and install Maven:

    Following page will provide the detailed steps to setup maven.

    Automatics Orchestration Setup#Maven3


    Background Color
    color#F5F5F5

    Environment Setup

    Following are the steps to be followed to setup Device Manager Server and its dependent softwares in a Machine:

    My SQL DB Setup and Configuration

    After installation of My SQL DB, connect to DB using MySQL command line tool.

    1.Create a database with name 'device_manager'.

                                    DB creation command :   

    Background Color
    colorblack


    mysql> create database  device_manager;

    mysql> use  device_manager;  -- For connecting to device_manager DB



    2.For creating all the tables required for Device Manager server, excecute the script 'sql' available with Device Manager source code inside 'device-manager\src\main\resources'.

                                    Excecute Table creation script:

                                    If already connected to 'device_manager' DB

    Background Color
    colorblack


    mysql> source <<path to 'Device_Manager_DB.sql' file>>


                                    To connect to 'device_manager' DB and run table creation scripts

    Background Color
    colorblack


    mysql -u root -p device_manager < Device_Manager_DB.sql



    3.Check whether all the tables are created successfully in DB, run the below command after connecting to 'device_manager' DB.

    Background Color
    colorblack


    mysql> show tables;


    Build Device Manager .war file

    Build the .war file of Device Manager server using Maven 3.8 and JDK 817.

    To do this follow the below steps:

    1. Pull the latest Device Manager project from the repository.
    2. After completing the pull, go the resources folder in the device manager project, and add the DB IP address, port, username and password in application.properties(device-manager\src\main\resources). Please note DB password should be Base64 encoded.
    3. If you need to run the application other than localhost:8080 host, please follow the below steps to update in application.properties file.
      • Navigate to resource folder in device manager project(device-manager\src\main\resource) folder.
      • Open application.properties and update springfox.documentation.swagger.v2.host={protocol}:{host:port} value with selected port of your choice.
    4. Now navigate to the project Home folder and run the command “mvn clean install”.
    5. This will build device-manager-1.0.0-SNAPSHOT<version>.war file of device-manager server in the folder “project_home/target”.

    Deploy Device Manager application

    Device Manager application should be deployed in Tomcat server (ver 8). Follow the below steps to deply deploy the application.

    1. Copy device-manager-1.0.0-SNAPSHOT<version>.war file from “project_home/target” to “TOMCAT_HOME/webapps” folder.
    2. Rename device-manager-1.0.0-SNAPSHOT.<version>.war to DeviceManager.war.
    3. If you need to run the tomcat server in a port other than 8080, please follow the below steps to change the same.
      • Navigate to the folder “TOMCAT_HOME/conf”.
      • Open server.xml and change the connector port in this file from 8080 to an available port of your choice. If another tomcat is running the same machine then change the DEFAULT Tomcat server SHUTDOWN port from 8005 to another available port. If you dont need to a SHUTDOWN port for tomcat then change the default port from 8005 to “-1”,.
    4. To start Device Manager application go to “TOMCAT_HOME/bin” folder and run sh or startup.bat (if its running on Microsoft windows) script.
    5. To verify server logs check “TOMCAT_HOME/logs/catalina.out” file.


    To verify Device Manager application go to the URL : “{protocol}://{host:port}/DeviceManager/deviceCategory/all“


    Upgrade Device Manager for Connected Client Setup

    If  DeviceManager is already deployed, but swagger API /Device/addDeviceUsingPOST not displaying following fields, then we have to upgrade Device Manager to configure connected client details.

    Image Added

    Steps to upgrade Device Manager

    1. Copy table creation sql command for 'device_extra_details' from Device_Manager.sql and execute it. This will create table device_extra_details in DB.
    2. Build and deploy the war file referring Build Device Manager .war file


    Upgrade Device Manager for Configuring Peripheral Device - Power Manager

    If Device Manager is already deployed, then please follow below steps to enable feature for configuring peripheral device power details.

    1. Copy table creation sql commands for 'power_manager_details', 'power_manager_operations' and 'power_device_mapping' from Device_Manager.sql and execute in mysql prompt.                                                                  This will create tables 'power_manager_details', 'power_manager_operations' and 'power_device_mapping' in DB.
    2. Build and deploy the war file referring Build Device Manager .war file
    3. Using swagger API, remote power manager details can be configured in Device Manager.
    4.  As first step, configure remote power manager details using PowerManager  add REST API. 

    Image Added

       5. Next, configure the power operations supported by Remote Power Manager using PowerOperations add REST API. Details of power operations like POWER ON, POWER OFF, POWER CYCLE and POWER STATUS to be configured

    Image Added

    6. Next, map the device with power slots of Remote Power Manager using PowerDevice add REST API. 

    Image Added

    Background Color
    color#F5F5F5

    Swagger Documentation

    Swagger UI is an tool which can be used to visualize and try out all the APIs of a web application. Swagger UI is integrated to Device Manager application and it could be used to visualize all the APIs in this application and Swagger UI can be used to invoke all the APIs in this application.

    Device Manager documentation and Tryout feature can used by going to the URL : “{protocol}://{host:port}/DeviceManager/swagger-ui.html