Git Product home page Git Product logo

iot-assettracking-demo's Introduction

Red Hat Fleet Telematics & Asset Tracking IoT Demo

This is an example IoT demo showing a realtime updating dashboard of data streaming from an IoT gateway device (based on Eclipse Kura) through an Eclipse Kapua-based instance.

It demonstrates realtime fleet telematics, package tracking, alerting, and a telemetry dashboard showing critical measurements of packages in transit, including temperature, humidity, displacement, light levels, etc.

Dashboard Screenshot Dashboard Screenshot

Technologies used:

Running on OpenShift

The demo deploys as an Angular.js app running on a Node.js runtime, along with JBoss Data Grid and a Data Grid proxy component that properly handles browser-based REST requests and relays to JBoss Data Grid via the Hotrod protocol.

Eclipse Kapua is also deployed and acts as the IoT cloud management layer.

Follow these steps to build and run the demo:

  1. Install and have access to an OpenShift Container Platform 3.4 or later or OpenShift Origin 1.4 or later. You must be able to use the oc command line tool.

  2. Clone this repo

git clone https://github.com/redhat-iot/summit2017
cd summit2017
  1. Issue the following commands to create a new OpenShift project and deploy the demo components:
oc new-project redhat-iot --display-name="Red Hat IoT Demo"
oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)
./openshift-deploy.sh

You can monitor the build with oc status or watch the deployments using the OpenShift web console.

If you see some components with "No Deployments" or are not building, you may need to add imagestream definitions for wildfly and jboss-datagrid. To do so, run these commands:

oc login -u system:admin (Or login with any userid that has cluster-admin privileges, TODO: Explain all options here)
oc create -n openshift -f https://raw.githubusercontent.com/jboss-openshift/application-templates/master/jboss-image-streams.json
oc create -n openshift -f https://raw.githubusercontent.com/openshift/origin/master/examples/image-streams/image-streams-centos7.json

Once everything is up and running, you can access the demo using the URL of the dashboard route, for example http://dashboard-redhat-iot.domain

Confirm that all the components are running successfully:

oc get pods --show-all=false

You should see the following pods and their status:

NAME READY STATUS
dashboard-1-xxx 1/1 Running
datastore-1-xxx 1/1 Running
datastore-proxy-1-xxx 1/1 Running
elasticsearch-1-xxx 1/1 Running
kapua-api-1-wc1l7 1/1 Running
kapua-broker-1-xxx 1/1 Running
kapua-console-1-xxx 1/1 Running
simulator-1-xxx 1/1 Running
sql-1-xxx 1/1 Running

Eclipse Kapua API Documentation

Eclipse Kapua exposes a REST API which can be used to access Kapua data and invoke Kapua operations. The REST API application is running as a dedicated Java process.

For example, to use the curl command login to Eclipse Kapua and retrieve an authentication token:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"password": ["your_password"], "username": "your_username"}' 'http://api-redhat-iot.domain/v1/authentication/user'

Once logged in, the retrieved token can be passed for future API calls, e.g.

curl -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer <AUTH_TOKEN_HERE>' http://api-redhat-iot.domain/v1/my_scope/devices

The complete API documentation can accessed using the URL of the api route, for example http://api-redhat-iot.domain/doc. More information on the REST API can be found in the Eclipse Kapua user guide.

Add template to "Add to project"

The following command will add the template and the options to the "Add to project" screen in the "Other" section. The template will deploy with defaults the same as it does using the scripts above.

oc create -f iot-demo.yml

Options

The template contains various optional parameters that can be specified when deploying the components:

oc process -f openshift-template.yaml OPTION1=value OPTION2=value | oc create -f -
  • MAVEN_MIRROR_URL - To speed up Maven-based builds
  • GOOGLE_MAPS_API_KEY - for your personal Google Maps API key
  • GIT_URI and GIT_REF - overrides where source code is pulled (e.g. using your own personal fork)
  • IMAGE_VERSION - Docker image tag to use when pulling Kapua (default latest)
  • DOCKER_ACCOUNT - Name of docker account to use when pulling Kapua (default: redhatiot)

There are other options in the template that can be overridden if you know what you are doing!

Uninstalling and cleaning up project

oc delete all --all -n redhat-iot && oc delete configmap hawkular-openshift-agent-kapua data-simulator-config -n redhat-iot

This will delete everything but the project "Red Hat IoT". This is suitable for testing new scripts, template, etc.

iot-assettracking-demo's People

Contributors

ccustine avatar ishuverma avatar jamesfalkner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iot-assettracking-demo's Issues

Error resolving ImageStreamTag - Dashboard & Code incompatibilities in Dashboard App

I'm getting this error when trying to build dashboard app.
Error resolving ImageStreamTag nodejs:4 in namespace openshift: unable to find latest tagged image redhat iot.

You can fix it by installing an old node.js 4 image template.
But in the config step, there are a los of code incopatibilities errors because old apps dependencies.
Dashboard app needs to be updated. Is onyone thinking in updating this?

Thanks in advanced for your help. - Hernan

datastore version 1.2 -> 1.4 in OpenShift 3.6

Hi,

I'm currently trying this. So far I noticed datastore will not build, as it has old version of jboss-datagrid-6/datagrid65-openshift. The one coming with OCP 3.6 is 1.4, which needs to be updated in deployment config.

Also I noticed minishift installs all jboss imagestreams, at least when using RH CDK. So the manual steps for that are not required while using RH CDK.

Prereq's

If you see some components with "No Deployments" or are not building, you may need to add imagestream definitions for wildfly and jboss-datagrid

These stream requirements are indeed hard requirements for fresh CDK install (Wildfly and JDG streams).

Kapua console is empty

When I have everything up and running, opening the Kapua console doesn't show any devices, data etc. I do get an exception that elastic search is missing an index when I open de data browser in Kapua.

Pods are not started

NAME READY STATUS RESTARTS AGE
dashboard-1-build 0/1 Error 0 19m
datastore-1-deploy 0/1 Error 0 4m
datastore-proxy-1-build 0/1 Error 0 19m
elasticsearch-1-deploy 0/1 Error 0 19m
kapua-api-1-deploy 0/1 Error 0 19m
kapua-broker-1-deploy 0/1 Error 0 19m
kapua-console-1-deploy 0/1 Error 0 19m
simulator-1-deploy 0/1 Error 0 19m
sql-1-deploy 0/1 Error 0 19m

oc status -v
In project Red Hat IoT Demo (redhat-iot) on server https://192.168.225.169:8443

http://dashboard-redhat-iot.192.168.225.169.xip.io to pod port 8080-tcp (svc/dashboard)
dc/dashboard deploys istag/dashboard:latest <-
bc/dashboard source builds https://github.com/redhat-iot/summit2017#master on openshift/nodejs:4
build #1 failed 19 minutes ago
deployment #1 waiting on image or update

svc/datastore-hotrod - 172.30.4.196:11333
dc/datastore deploys openshift/jboss-datagrid65-openshift:1.2
deployment #1 failed 5 minutes ago: image change

http://datastore-proxy-redhat-iot.192.168.225.169.xip.io to pod port 8080-tcp (svc/datastore-proxy)
dc/datastore-proxy deploys istag/datastore-proxy:latest <-
bc/datastore-proxy source builds https://github.com/redhat-iot/summit2017#master on openshift/wildfly:10.1
build #1 failed 19 minutes ago
deployment #1 waiting on image or update

http://search-redhat-iot.192.168.225.169.xip.io to pod port http (svc/elasticsearch)
dc/elasticsearch deploys docker.io/library/elasticsearch:2.4
deployment #1 failed 20 minutes ago: config change

http://api-redhat-iot.192.168.225.169.xip.io to pod port http (svc/kapua-api)
dc/kapua-api deploys docker.io/redhatiot/kapua-api-jetty:2017-04-08
deployment #1 failed 20 minutes ago: config change

http://broker-redhat-iot.192.168.225.169.xip.io to pod port mqtt-websocket-tcp (svc/kapua-broker)
dc/kapua-broker deploys docker.io/redhatiot/kapua-broker:2017-04-08
deployment #1 failed 20 minutes ago: config change

http://console-redhat-iot.192.168.225.169.xip.io to pod port http (svc/kapua-console)
dc/kapua-console deploys docker.io/redhatiot/kapua-console-jetty:2017-04-08
deployment #1 failed 20 minutes ago: config change

svc/sql - 172.30.56.47 ports 3306, 8181
dc/sql deploys docker.io/redhatiot/kapua-sql:2017-04-08
deployment #1 failed 20 minutes ago: config change

dc/simulator deploys docker.io/redhatiot/kura-simulator:2017-04-08
deployment #1 failed 20 minutes ago: config change

Errors:

  • build/dashboard-1 has failed.
    try: Inspect the build failure with 'oc logs -f bc/dashboard'
  • build/datastore-proxy-1 has failed.
    try: Inspect the build failure with 'oc logs -f bc/datastore-proxy'
  • route/api is routing traffic to svc/kapua-api, but either the administrator has not installed a router or the router is not selecting this route.
    try: oc adm router -h
  • route/broker is routing traffic to svc/kapua-broker, but either the administrator has not installed a router or the router is not selecting this route.
    try: oc adm router -h
  • route/console is routing traffic to svc/kapua-console, but either the administrator has not installed a router or the router is not selecting this route.
    try: oc adm router -h
  • route/dashboard is routing traffic to svc/dashboard, but either the administrator has not installed a router or the router is not selecting this route.
    try: oc adm router -h
  • route/datastore-proxy is routing traffic to svc/datastore-proxy, but either the administrator has not installed a router or the router is not selecting this route.
    try: oc adm router -h
  • route/search is routing traffic to svc/elasticsearch, but either the administrator has not installed a router or the router is not selecting this route.
    try: oc adm router -h

Warnings:

  • The image trigger for dc/dashboard will have no effect until istag/dashboard:latest is imported or created by a build.
  • The image trigger for dc/datastore-proxy will have no effect until istag/datastore-proxy:latest is imported or created by a build.

Info:

  • pod/dashboard-1-build has no liveness probe to verify pods are still running.
    try: oc set probe pod/dashboard-1-build --liveness ...
  • pod/datastore-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/datastore-1-deploy --liveness ...
  • pod/datastore-proxy-1-build has no liveness probe to verify pods are still running.
    try: oc set probe pod/datastore-proxy-1-build --liveness ...
  • pod/elasticsearch-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/elasticsearch-1-deploy --liveness ...
  • pod/kapua-api-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/kapua-api-1-deploy --liveness ...
  • pod/kapua-broker-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/kapua-broker-1-deploy --liveness ...
  • pod/kapua-console-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/kapua-console-1-deploy --liveness ...
  • pod/simulator-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/simulator-1-deploy --liveness ...
  • pod/sql-1-deploy has no liveness probe to verify pods are still running.
    try: oc set probe pod/sql-1-deploy --liveness ...
  • dc/datastore has no readiness probe to verify pods are ready to accept traffic or ensure deployment is successful.
    try: oc set probe dc/datastore --readiness ...
  • dc/datastore has no liveness probe to verify pods are still running.
    try: oc set probe dc/datastore --liveness ...
  • dc/elasticsearch has no liveness probe to verify pods are still running.
    try: oc set probe dc/elasticsearch --liveness ...
  • dc/kapua-api has no liveness probe to verify pods are still running.
    try: oc set probe dc/kapua-api --liveness ...
  • dc/kapua-broker has no liveness probe to verify pods are still running.
    try: oc set probe dc/kapua-broker --liveness ...
  • dc/kapua-console has no liveness probe to verify pods are still running.
    try: oc set probe dc/kapua-console --liveness ...
  • dc/simulator has no readiness probe to verify pods are ready to accept traffic or ensure deployment is successful.
    try: oc set probe dc/simulator --readiness ...
  • dc/simulator has no liveness probe to verify pods are still running.
    try: oc set probe dc/simulator --liveness ...
  • dc/sql has no liveness probe to verify pods are still running.
    try: oc set probe dc/sql --liveness ...

View details with 'oc describe /' or list everything with 'oc get all'.

Errors:
oc logs -f bc/dashboard
error: cannot connect to the server: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
ganesh@ganesh-Lenovo-ideapad-100-14IBD:~/summit2017$ oc logs -f bc/datastore-proxy
error: cannot connect to the server: open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
oc adm router -o yaml
error: router could not be created; service account "router" is not allowed to access the host network on nodes, grant access with oadm policy add-scc-to-user hostnetwork -z router
apiVersion: v1
items:

  • apiVersion: v1
    kind: ServiceAccount
    metadata:
    creationTimestamp: null
    name: router
  • apiVersion: v1
    groupNames: null
    kind: ClusterRoleBinding
    metadata:
    creationTimestamp: null
    name: router-router-role
    roleRef:
    kind: ClusterRole
    name: system:router
    subjects:
    • kind: ServiceAccount
      name: router
      namespace: redhat-iot
      userNames:
    • system:serviceaccount:redhat-iot:router
  • apiVersion: v1
    kind: DeploymentConfig
    metadata:
    creationTimestamp: null
    labels:
    router: router
    name: router
    spec:
    replicas: 1
    selector:
    router: router
    strategy:
    resources: {}
    rollingParams:
    maxSurge: 0
    maxUnavailable: 25%
    type: Rolling
    template:
    metadata:
    creationTimestamp: null
    labels:
    router: router
    spec:
    containers:
    - env:
    - name: DEFAULT_CERTIFICATE_DIR
    value: /etc/pki/tls/private
    - name: ROUTER_EXTERNAL_HOST_HOSTNAME
    - name: ROUTER_EXTERNAL_HOST_HTTPS_VSERVER
    - name: ROUTER_EXTERNAL_HOST_HTTP_VSERVER
    - name: ROUTER_EXTERNAL_HOST_INSECURE
    value: "false"
    - name: ROUTER_EXTERNAL_HOST_INTERNAL_ADDRESS
    - name: ROUTER_EXTERNAL_HOST_PARTITION_PATH
    - name: ROUTER_EXTERNAL_HOST_PASSWORD
    - name: ROUTER_EXTERNAL_HOST_PRIVKEY
    value: /etc/secret-volume/router.pem
    - name: ROUTER_EXTERNAL_HOST_USERNAME
    - name: ROUTER_EXTERNAL_HOST_VXLAN_GW_CIDR
    - name: ROUTER_SERVICE_HTTPS_PORT
    value: "443"
    - name: ROUTER_SERVICE_HTTP_PORT
    value: "80"
    - name: ROUTER_SERVICE_NAME
    value: router
    - name: ROUTER_SERVICE_NAMESPACE
    value: redhat-iot
    - name: ROUTER_SUBDOMAIN
    - name: STATS_PASSWORD
    value: PjMPJuiol6
    - name: STATS_PORT
    value: "1936"
    - name: STATS_USERNAME
    value: admin
    image: openshift/origin-haproxy-router:v1.5.0
    imagePullPolicy: IfNotPresent
    livenessProbe:
    httpGet:
    host: localhost
    path: /healthz
    port: 1936
    initialDelaySeconds: 10
    name: router
    ports:
    - containerPort: 80
    - containerPort: 443
    - containerPort: 1936
    name: stats
    protocol: TCP
    readinessProbe:
    httpGet:
    host: localhost
    path: /healthz
    port: 1936
    initialDelaySeconds: 10
    resources:
    requests:
    cpu: 100m
    memory: 256Mi
    volumeMounts:
    - mountPath: /etc/pki/tls/private
    name: server-certificate
    readOnly: true
    hostNetwork: true
    securityContext: {}
    serviceAccount: router
    serviceAccountName: router
    volumes:
    - name: server-certificate
    secret:
    secretName: router-certs
    test: false
    triggers:
    • type: ConfigChange
      status:
      availableReplicas: 0
      latestVersion: 0
      observedGeneration: 0
      replicas: 0
      unavailableReplicas: 0
      updatedReplicas: 0
  • apiVersion: v1
    kind: Service
    metadata:
    annotations:
    service.alpha.openshift.io/serving-cert-secret-name: router-certs
    creationTimestamp: null
    labels:
    router: router
    name: router
    spec:
    ports:
    • name: 80-tcp
      port: 80
      targetPort: 80
    • name: 443-tcp
      port: 443
      targetPort: 443
    • name: 1936-tcp
      port: 1936
      protocol: TCP
      targetPort: 1936
      selector:
      router: router
      status:
      loadBalancer: {}
      kind: List
      metadata: {}

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.