EIS Docker Container Base

From ESS-WIKI
Revision as of 05:45, 29 March 2017 by Eric.liang (talk | contribs)
Jump to: navigation, search

Introduction

    This page introduces Advantech Edge Intelligence Server (EIS) for Internet of Things gateway solution.

    To develop an IoT product will cover various technical fields include: Sensor, Connectivity, Secure, Cloud, Storage, device maintenance, Edge/Cloud Analytics, System Integration, Device Hardware, and Application development, and so on. One the first challenges that many companies face is how to migrate to an IoT application while balancing design time, time to market, and risk. IoT data can be large in terms of volume and the applications typically have real-time requirements. Transmitting massive amounts of raw data over a network puts a tremendous load on network resources. In some cases, it is much more efficient to process data near its source and send only the data that has value over the network to a Cloud center. Edge computing is a distributed information technology (IT) architecture in which client data is processed at the periphery of the network, as close to the originating source as possible. Time-sensitive data in an edge computing may be processed at the point of origin by an intelligent device or sent to an intermediary server located in close geographical proximity to the client. Data that is less time sensitive is sent to the cloud for historical analysis, big data analytics, and long-term storage.

    Advantech EIS adopts the Edge computing Architecture for IoT gateway solution. EIS enables local IoT networks to perform edge intelligence to maximize energy efficiency, reduce privacy threats, easy implementation, modularization(containerized) and minimize latencies.


Microservice

    EIS adopted the Microservice Architecture pattern. Instead of building a single monstrous, monolithic application, the idea is to split your application into set of smaller, interconnected services. A service typically implements a set of distinct features or functionality, such as connectivity management, vertical application, etc. Each microservice is a mini-application that has its own hexagonal architecture consisting of business logic along with various adapters.

Benefits:

  • Consequently, individual services are much faster to develop, and much easier to understand and maintain
  • Enables each service to be developed independently by a team that is focused on that service
  • Enables each microservice to be deployed independently. It makes continuous deployment possible
  • Enables each service to be scaled independently

Docker Container

Architecture of docker container.jpg

    EIS software service runs as a Docker Container. Each service is independently. Customer can easily migrate application with Docker Container. For example, a customer’s application runs in CentOS. Customer can build a CentOS Container to service it and integrate with EIS system. It makes easily migrate your application into EIS system. The following describes the Docker Container technology and advantages.

    Containerization -- is an OS-level virtualization method for deploying and running distributed applications without launching an entire VM for each application. Instead, multiple isolated systems, called containers, are run on a single control host and access a single kernel.  As shown in above picture, containers share the same OS kernel as the host, containers can be more efficient than VMs, which require separate OS instances.

    Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in. Containers hold the components necessary to run the desired software, such as files, environment variables, and libraries. The host OS also constrains the container's access to physical resources -- such as CPU and memory -- so a single container cannot consume all of a host's physical resources.


EIS Software Service

EIS SW Architecture

   This picture describes the EIS design concept, not all services are ready for to be released. The EIS Software Architecture classified into 5 categories layers. Each service is now implemented by its own microservice. Services use MQTT broker as the communication bus. All microservices would expose an API that’s consumed by other microservices or clients. At runtime, each instance is a Docker container. This makes it easier to deploy distinct experiences for specific users, devices, or specialized use cases. The customer can easily develop and deploy its own service in EIS SW architecture.

  • The bottom layer of the architecture is the wired and wireless sensor network connectivity layer. Wire sensor supports various types (et. SCADA, Modbus, OPCUA…). Wireless Connectivity can be of various types (et. WiFi, Lora, 6LoPAN…). Network connectivity layer is charged for collecting, and management sensor hubs device. And transit protocol to MQTT protocol, and then pass to MQTT communication bus.
  • Second, SDK Layer provides various SW services like EIS REST API, HDD Fault Prediction Algorithm Service, and so on. The developer can call these services by REST API or MQTT protocol. The user can add its own service in this Layer (et. Machine Learning Platform, Data Base engine, and so on…).
  • Third, Flow-base Layer provides the Node-RED as the data flow design engine. The customer can easy to wire together flows using Advantech add-on nodes such as SUSI API, WSN, and HDD prediction nodes. It helps quickly design customer’s application logic by drag and drops easy way.
  • Fourth, Management and Presentation UI Interface Layer; EIS provides Webmin for system administration and IoT connection configuration. The Node-RED-UI for presenting IoT/sensor data.
  • Fifth, Cloud Layer. EIS is pre-installed the WISEAgent connect to WISE-PaaS/RMM Cloud Server. We also provide the 3rd party Cloud Service Agent (et. Microsoft Azure, IBM Bluemix, ARM mbed Cloud…).


Docker Container Services

REST API GW

EIS REST API Architecture.jpg

 

    REST API GW is the entry point for all EIS software services. The REST API handles requests in one of two ways. Some requests are simply routed to the appropriate service. It handles other requests by fanning out to multiple services. REST API service gathers pre-process data and generate RETS APIs for EIS software services as about picture. The REST API is also responsible for tasks such as load balancing, caching, access control, API metering, and monitoring, and can be implemented effectively using NodeJS express. The customer can easily and quickly develop its application, data flow, and web application by REST API.

dust-link

    Dust-link docker container is the linear dust network manager service. This service control and collecte of dust link SenHub by "/dev/ttyUSB0" UART port. It also send dust link manager and senhub data to mqtt-bus EIS system with WISESnail. User can access the dust-link manage interface and SenHub by RESTful API.

mqtt-bus

    EIS uses the MQTT broker as the asynchronous communication bus for Inter-service communication. Inter-service communication protocol base on MQTT standard and IETF (The Internet Engineering Task Force) defined media types for Sensor Makeup Language (SenML) in JSON format. The user can follow EIS communication protocol or use the “WISE Sensor Network Abstract Layer” (WISESnail the lightweight WISEAgent) SDK to integrate a new service with the EIS eco-system.

hdd-pmq

    Industrial PCs often operate in the harsh environment with wide temperature range and high vibration, which will shorten the life of HDD and cause catastrophic failure. With WISE-PaaS/RMM solution and EIS PMQ module, S.M.A.R.T. code of Hard Disk can be real-time monitored, which can be used to predict the failure in the near future, providing related alerts or notification for customers to take actions accordingly. HDD PMQ module collects real-time hard disk S.M.A.R.T code from WISE-agent, fed into the PMQ library to make the failure prediction. HDD PMQ doesn’t send our real-time data to WISE-PaaS/RMM server. Instead, HDD PMQ send the alert message and corresponding notification if the failure has been predicted.

node-red

    Node-RED is available as open source and implemented by the IBM Emerging Technology organization. It provides a browser-based flow editor that easily wires together flows using the wide range nodes in the palette. Flows can be then deployed to the runtime in a single-click. The flows created in Node-RED are stored using JSON which can be easily imported and exported for sharing with others. With built in node.js, it can be run at the edge of the network or in the cloud. The node package manager (npm) ecosystem can be used to easily extend the palette of nodes available, enabling connections to new devices and services.

wsn nodes

  Wireless Sensor Network (WSN) Nodes are supported on Advantech IoT Gateway and all provided features are basically described by REST API respectively. For users to quickly access the WSN features and build the prototype control flow of application before knowing the detailed REST API manipulation and programming, we provide the following Node-RED nodes to easily read the information and access functions of WSN on EIS.

hdd-pmq node

Management

Webmin 

    EIS pre-installed Webmin for system administration. It is a web-based interface open source project.Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely.

    Webmin is designed to allow the easy addition of new modules without changing any of the existing code. A module can be thought of as something like a Photoshop plugin or iPhone application - it can be written by someone other than the developers of Webmin and distributed under a license the developer chooses. You can refer the Module Development for developing your module.

    EIS provides add-on modules in Webmin such as WISEAgent manage modules. WISEAgent manage: Configure the WISE-PaaS/RMM Server address, device name,device id, and connection status.

EIS Webmin default account / password is "adv" and "adv".  

Install webmin modules

Webmin webmin modules 1.831.jpg

Webmin modules installation page


Webmin webmin modules2 1.831.jpg

Choice Webmin module from local file.

WISE-Agent Setting / Status

 Networking -> WISE Cloud Setting

Webmin wisecloud setting 1.831.jpg

Page of WISEAgent setting

 Networking -> WISE Cloud Status

Webmin wisecloud status connected 1.831.jpg

WISEAgent connected to WISE-PaaS/RMM


Webmin wisecloud status disconnect 1.831.jpg

WISEAgent disconnect with WISE-PaaS/RMM

Kitematic

    EIS pre-installed the Kitematic for system administration.Kitematic is an open source project built to simplify and streamline using Docker on PC. Kitematic automates the Docker installation and setup process and provides an intuitive graphical user interface (GUI) for running Docker containers. 

Cloud Solution

WISE-PaaS / WISE-Agent

    EIS pre-installed the WISE-Agent connect to Advantech WISE-PaaS/RMM Cloud Server. EIS services will publish to WISE-PaaS/RMM Cloud Server by WISE-Agent. Customer can access, control, and management these IoT devices and services with WISE-PaaS/RMM Cloud Server. EIS is responsible for acquisition of sensor data and forwarding meaningful data to Cloud for analysis and big data storage. Customer also develops its own handler integrate with WISE-Agent framework. You could refer  WISE-Agent for detail information.

How to Guide

Delopy EIS Image to USB or HDD Disk

To check USB or HDD Disk name

sudo fdisk -l 


Deploy the image to USB flash drive . Note: The deploy process takes about 15 minutes.

gunzip EIS_V2.0.3_Ubuntu-14.04_x86_64_3.19_20170329.img.gz
sudo dd if=./EIS_V2.0.3_Ubuntu-14.04_x86_64_3.19_20170329.img of=/dev/sdx bs=4M; sync


Boot for USB or HDD Disk

  1. Insert the USB Flash / HDD Drive into the ARK-2121L
  2. Boot up to the BIOS menu of your ARK-2121L by pressing ESC on the keyboard as it boots up.
  3. Change the boot device to be the USB/HDD flash drive, then press F4 to save and exit
  4. System should boot up using the USB Flash Drive.
  5. Log in as user: adv  password: adv
  6. The EIS Version 2.0 is ready to use.


Re-size EIS File System

#sudo fdisk /dev/sda
 d -> 1      : delete partition 1
 d -> 2      : delete partition 2
 n -> p -> 1 : you can set how many size you want to set
 w           : write result
#sudo reboot 
#sudo resize2fs /dev/sda1
// To check new partition size
#df -h 


Check and Upgrade the EIS Docker Service to latest version 

cd ~/Advantech/docker

./deploy.sh update


Run the Kitematic

cd ~/Advantech/kitematic
sudo ./run.sh

Development

WSN Simulator

Start and enter the WSN Simulator Docker Container bash 

$cd ~/Advantech /docker

$./deploy.sh wsn-sim.sh bash

Start running the wsn-simulator. It will simulate WSN connectivity and senhub and send data to mqtt bus. You can design and edit your wsn type and senhub information.

#./wisesim

Exit the container service

#exit

WSN Development Environment

Start and enter the WSN Development Docker Container bash 

$cd ~/Advantech /docker

$./deploy.sh wsn-dev.sh bash

You can refer WISESnail for detail information.


EIS releases

This is an overview that displays EIS versions and some stats and numbers for each release.

index Version Date Platform OS Release Note
1 v2.0.1 2016/12/06 x86_64 CPU Not include OS  release-noet-EIS-v2.0.1   
2 v2.0.2 2017/02/24 ARK-2121L Ubuntu 14.04 x86_64  release-note_EIS-v2.0.2  / Functional Specification
3 v2.0.3 2017/03/29 ARK-2121L Ubuntu 14.04 x86_64