An open API service indexing awesome lists of open source software.

https://github.com/dmarrazzo/iot_demo_allinone

All in one wrapper for the IoT_Demo_* repositories
https://github.com/dmarrazzo/iot_demo_allinone

Last synced: 3 months ago
JSON representation

All in one wrapper for the IoT_Demo_* repositories

Awesome Lists containing this project

README

        

= IoT Demo - Gateway

:Author: Patrick Steiner
:Email: [email protected]
:Date: 23.01.2016

:toc: macro

toc::[]

== Purpose
This repository is a combined version of the following three IoT Demo repositories:

* https://github.com/PatrickSteiner/IoT_Demo_Sensors[Edge / Sensors]: creation of data
* https://github.com/PatrickSteiner/IoT_Demo_Gateway[Smart Gateway / Controller]: first level of data processing
* https://github.com/PatrickSteiner/IoT_Demo_Datacenter[Datacenter]: well, the datacenter ...

these three are designed to run in three different places to represent a proper 3-Tier IoT Scenario.

For simpler demonstration and evaluation, this repo is build to run all on one system with all elements separeted
in their own Docker-based container.

These capabilities needed implemented out of a set of
Red Hat JBoss products, each taking over an important part in the IoT landscape

image::pictures/Overview.png[]

=== Hardware requirements
As this setup consists of 7 running containers, each hosting a full-blown version
of a Red Hat JBoss product, you will want to run it on at least

* 2 CPU ( physical or virtual )
* 12 GB RAM

I personally am running it with amazing response times in a VM ( 2 vCPU, 12GM ) on a Macbook Pro

=== Software requirements
Your host server for this demo will need to have

* git
* Maven ( I'm on V 3.3.9 )
* Ansible ( I'm on V 2.0.0.2 )
* Docker ( I'm running docker-machine V1.9.1 )
* docker-compose ( I'm running V1.5.2 )

WARNING: If you run the Ansible script with something else then `root` ( which you can), please make sure, that your user is capable of running the `docker` commands.

WARNING: In demo setups and to reduce complexity, you might want to consider to
deactivate firewall on your system.
If you don't please to open up the following port: 1883 ( my default port for MQTT )

=== Build procedure

==== Clone Master Repo
To start with this All-In-One IoT Demo, you will have to clone this repo

```
Patricks-MacBook-Pro:Demos psteiner$ git clone https://github.com/PatrickSteiner/IoT_Demo_AllInOne.git
Cloning into 'IoT_Demo_AllInOne'...
remote: Counting objects: 27, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 27 (delta 6), reused 21 (delta 3), pack-reused 0
Unpacking objects: 100% (27/27), done.
Checking connectivity... done.
```

==== Provide Red Hat JBoss Products
You will have to copy the following products into their needed location

* https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=37393[JBoss EAP 6.4.0] into directory `./software/`
* https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=42471[JBoss EAP Patch 6.4.6] into directory `./software/`
* https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=41161[JBoss BPM Suite] into directory `./software/`
* https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=41311[JBoss Fuse on Karaf] into directory `./software/`
* https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=42191[JBoss DataGrid] into directory `./software/`
* https://access.redhat.com/jbossnetwork/restricted/softwareDownload.html?softwareId=42331[JBoss Data Grid 6.6.0 Library Module for JBoss EAP 6] into directory `./software/`

=== Building the All-In-One Demo
I have provided an Ansible playbook for your convenience, so all you need to run is

```
Patricks-MacBook-Pro:IoT_Demo_AllInOne psteiner$ cd Ansible/
Patricks-MacBook-Pro:Ansible psteiner$ ansible-playbook demo.yml

...

PLAY RECAP *********************************************************************
localhost : ok=17 changed=9 unreachable=0 failed=0
```

CAUTION: *Fedora / RHEL Users*

Fedora and RHEL for security reasons requires root privileges to run docker (your user must be a sudoer).
So in those envs, you have to issue the following command and type in your credentials:

```
$ ansible-playbook demo_root.yml --ask-become-pass
```

== Start Environment
Starting the IoT All-In-One demo is a manual step.

```
pi@gateway:~ $ cd IoT_Demo_AllInOne
pi@gateway:~/IoT_Demo_Gateway $ docker-compose up -d
```

To "monitor" the startup or runtime of the Smart Gateway you can use the command

```
pi@gateway:~/IoT_Demo_AllInOne $ docker-compose logs
bpm_1 | 12:28:55,900 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://0.0.0.0:9990
bpm_1 | 12:28:55,901 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) started in 98012ms - Started 1106 of 1143 services (82 services are lazy, passive or on-demand)
```

Once you see the `100%` you are good to go!

To access the various Web-UIs you can use the following links

[width="80%",frame="topbot",options="header,footer"]
|==================================
| Role | URL | uid / password
| Fuse in Datacenter | http://localhost:8181/hawtio/login | admin / change12_me
| Fuse on Gateway | http://localhost:8282/hawtio/login | admin / change12_me
| BPM Suite | http://localhost:8080/business-central/kie-wb.html | psteiner / change12_me
|==================================

=== Deploy BPM Process
Until now, I have not found an automated way to build and deploy the business process
within JBoss BPM Suite. So to do that, you will have to

1. Upload `IoT_Demo_Datacenter/bpm/LightWorkItemHandler/target/lightWorkItemHandler-1.0.0-SNAPSHOT.jar` to the repository of JBoss BPM Suite
2. Build & Deploy the process from the Project Explorer of JBoss BPM Suite.

=== Generate Testdata
If you should not have a physical sensor who reports data out IoT Demo, then you
can use the provided Software-Sensor, which is just a simple Java programm
which produces testdata and sends it to the MQTT Broker of the Gateway.

Please take a look at the file `./run.sh` which should be self-explanatory.
As the rule to create an alert and with the alert a JBoss BPM process is expecting
a temperature reading of >= 27, there is also a script `./runHigh.sh` which
will do just that.