Git Product home page Git Product logo

hono-demo-1's Introduction

Installation

This setup requires an existing installation of Minishift and follows the installation instructions for Hono on EnMasse using S2I: https://github.com/ctron/hono/tree/feature/support_s2i_05x/openshift

This tutorial will assume that you have a Unix-ish operating system and at least the following command line tools installed:

  • minishift, oc
  • curl, wget, jq, bash, tar

Create a Minishift instance

First you will need to start up minishift:

minishift start --cpus 4 --memory 16GB --disk-size 40GB

Check out this repository

This readme file will assume that you have cloned (checked out) out the repository and are executing commands from inside the working space of your clone. Cloning is as easy as:

git clone http://github.com/ctron/hono-demo-1

Or the following command if you want to check out the develop branch instead:

git clone http://github.com/ctron/hono-demo-1 -b develop

Install EnMasse

Create a new EnMasse project:

oc new-project enmasse --display-name='EnMasse Instance'

Download, unpack and deploy EnMasse:

wget https://github.com/EnMasseProject/enmasse/releases/download/0.17.0/enmasse-0.17.0.tgz
tar xzf enmasse-0.17.0.tgz
cd enmasse-0.17.0
./deploy-openshift.sh -n enmasse -m "$(minishift console --url)"
cd ..

Note: After the deployment of EnMasse the system might need a while to download and install container images. Please wait for all pods to start before continuing. You can track the progress using the OpenShift Web UI.

Configure EnMasse

The following step will create the addresses for DEFAULT_TENANT:

curl -X PUT --insecure -T src/openshift/addresses.json -H "content-type: application/json" https://$(oc -n enmasse get route restapi -o jsonpath='{.spec.host}')/apis/enmasse.io/v1/addresses/default

Install Eclipse Hono

oc new-project hono --display-name='Eclipse Hono™'
oc -n hono create configmap influxdb-config --from-file=src/openshift/influxdb.conf
oc process -f https://raw.githubusercontent.com/ctron/hono/feature/support_s2i_05x/openshift/hono.yml \
   -p "ENMASSE_NAMESPACE=enmasse" \
   -p "GIT_REPOSITORY=https://github.com/ctron/hono" \
   -p "GIT_BRANCH=feature/support_s2i_05x"| oc create -f -

Note: After executing the template container images will be downloaded and builds will be triggered in order to start up Hono. Please wait for all pods to start before continuing. You can track the progress using the OpenShift Web UI.

Increase the number of devices

By default Hono limits the number of devices to 100 for its examples device registry.

This limit can be set by executing:

oc env -n hono dc/hono-service-device-registry HONO_REGISTRY_SVC_MAX_DEVICES_PER_TENANT=10000

Note: Please remember that this device registry is held in-memory and flushed to disk using JSON. So performance might become an issue with too many devices.

Deploy the demo

Create a new project for the simulator and deploy it:

oc new-project iot-simulator --display-name='IoT workload simulator'
oc process -f src/openshift/demo.yml | oc create -f -

Install Grafana

Grafana can be deployed in order to watch the metrics of Hono and also see the simulated payload. It can be installed by executing the following commands:

oc new-project grafana --display-name='Grafana Dashboard'
oc process -f https://raw.githubusercontent.com/ctron/hono/feature/support_s2i_05x/openshift/grafana.yml \
   -p ADMIN_PASSWORD=admin | oc create -f -

Configure Grafana

The following command line requests require the use of the Grafana URL and will use the environment variable GRAFANA_URL for that. You can set the URL in your local shell using:

GRAFANA_URL="$(oc -n grafana get route grafana --template='{{ .spec.host }}')"
echo "http://$GRAFANA_URL"

It is also possible to open the URL with a web browser in order to view dashboards and configurations. The credentials for this instance are admin / admin.

Create two new datasources by executing the following commands:

curl -X POST -T src/grafana/ds_hono.json -H "content-type: application/json" "http://admin:admin@$GRAFANA_URL/api/datasources"
curl -X POST -T src/grafana/ds_payload.json -H "content-type: application/json" "http://admin:admin@$GRAFANA_URL/api/datasources"

curl -X POST -T src/grafana/dashboard_hono.json -H "content-type: application/json" "http://admin:admin@$GRAFANA_URL/api/dashboards/db"
curl -X POST -T src/grafana/dashboard_payload.json -H "content-type: application/json" "http://admin:admin@$GRAFANA_URL/api/dashboards/db"

What now?

Now you have an IoT simulator running, which will stream a data set to the Eclipse Hono instance. The IoT consumer will consume the simulated payload and store it in the metrics database of Hono.

Some dashboards

You can check the following URLs:

$GRAFANA_URL/dashboard/db/ampds2
This shows the payload as it is stored in the InfluxDB payload instance.
$GRAFANA_URL/dashboard/db/hono
Shows the metrics of the Eclipse Hono instances. Initially this should show a "stunning" 1 message/second throughput.

Installing Eclipse Che

You can install Eclipse Che to the setup by executing the following commands:

DEPLOY_ROOT_URL=https://raw.githubusercontent.com/eclipse/che/6.1.x/dockerfiles/init/modules/openshift/files/scripts/
curl -fL "$DEPLOY_ROOT_URL/deploy_che.sh" -o get-che.sh
curl -fL "$DEPLOY_ROOT_URL/che-openshift.yml" -o che-openshift.yml
curl -fL "$DEPLOY_ROOT_URL/che-config" -o che-config
export CHE_IMAGE_TAG=6.1.1
bash ./get-che.sh

After Che is initialized you can import the example project and start working on it:

CHE_URL="http://$(oc -n eclipse-che get route che --template='{{ .spec.host }}')"
echo "Open browser at: $CHE_URL/f?url=https://github.com/ctron/hono-demo-1"

Make changes & run

You can now open this project in Che and start making changes using the IDE.

It is possible to run the project directly from within the Che IDE by running the "buildAndRun" command. The URL to the application is showing on top of the console output.

Deploy as project

It is also possible to create a standard OpenShift project from the sources in a few steps with the following commands:

oc new-project demo-gauge
oc new-app https://github.com/ctron/hono-demo-1 --context-dir=demo-gauge
oc expose svc/hono-demo-1

hono-demo-1's People

Contributors

ctron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hono-demo-1's Issues

hono/hono-demo-1-base failing to build in minishift


[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ hono-core ---
--
  | [INFO] Using 'UTF-8' encoding to copy filtered resources.
  | [INFO] skip non existing resourceDirectory /hono/core/src/main/resources
  | [INFO]
  | [INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ hono-core ---
  | [INFO] Changes detected - recompiling the module!
  | [INFO] Compiling 32 source files to /hono/core/target/classes
  | [INFO] ------------------------------------------------------------------------
  | [INFO] Reactor Summary:
  | [INFO]
  | [INFO] Hono ............................................... SUCCESS [ 21.949 s]
  | [INFO] Hono Dependencies .................................. SUCCESS [  0.010 s]
  | [INFO] Legal Documents .................................... SUCCESS [  2.953 s]
  | [INFO] Hono Demo Certs .................................... SUCCESS [  0.054 s]
  | [INFO] Hono Core .......................................... FAILURE [ 13.962 s]
  | [INFO] Hono Client ........................................ SKIPPED
  | [INFO] Hono Service base .................................. SKIPPED
  | [INFO] Hono Protocol Adapters ............................. SKIPPED
  | [INFO] Hono HTTP Adapter base ............................. SKIPPED
  | [INFO] Hono REST Adapter .................................. SKIPPED
  | [INFO] Hono MQTT Adapter base ............................. SKIPPED
  | [INFO] Hono MQTT Adapter .................................. SKIPPED
  | [INFO] Hono Kura Adapter .................................. SKIPPED
  | [INFO] Hono Artemis ....................................... SKIPPED
  | [INFO] Hono Dispatch Router ............................... SKIPPED
  | [INFO] Metrics Docker Images .............................. SKIPPED
  | [INFO] Hono Services ...................................... SKIPPED
  | [INFO] Hono Auth .......................................... SKIPPED
  | [INFO] Hono Device Registry ............................... SKIPPED
  | [INFO] Hono Messaging ..................................... SKIPPED
  | [INFO] Hono Examples ...................................... SKIPPED
  | [INFO] Hono JMeter Plugin ................................. SKIPPED
  | [INFO] Hono Site .......................................... SKIPPED
  | [INFO] Hono Integration Tests ............................. SKIPPED
  | [INFO] ------------------------------------------------------------------------
  | [INFO] BUILD FAILURE
  | [INFO] ------------------------------------------------------------------------
  | [INFO] Total time: 55.928 s
  | [INFO] Finished at: 2017-11-20T15:39:46+00:00
  | [INFO] Final Memory: 28M/240M
  | [INFO] ------------------------------------------------------------------------
  | [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project hono-core: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
  | [ERROR]
  | [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  | [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  | [ERROR]
  | [ERROR] For more information about the errors and possible solutions, please read the following articles:
  | [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
  | [ERROR]
  | [ERROR] After correcting the problems, you can resume the build with the command
  | [ERROR]   mvn <goals> -rf :hono-core
  | error: build error: The command '/bin/sh -c scl enable rh-maven33 "cd hono && mvn -B clean install -DskipTests"' returned a non-zero code: 1


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.