Git Product home page Git Product logo

sa-mw-dach / bobbycar Goto Github PK

View Code? Open in Web Editor NEW
44.0 16.0 28.0 10.19 MB

IoT Transportation demo using Red Hat OpenShift and Middleware technologies

License: Apache License 2.0

Java 32.65% HTML 56.97% JavaScript 0.18% TypeScript 6.88% SCSS 1.90% Smarty 0.37% CSS 0.01% Dockerfile 0.02% Shell 1.02%
openshift-v4 quarkus kafka mqtt api-gateway tekton-pipelines codeready-workspaces amq prometheus camel-k

bobbycar's Introduction

About Bobbycar - The Red Hat Connected Vehicle Architecture

Bobbycar is a Red Hat solution pattern that implements key aspects of a modern IoT/Edge architecture in an exemplary manner. It uses Red Hat OpenShift Container Platform and various middleware components optimized for a cloud-native usage.

This enterprise architecture can serve as a foundation for an IoT/Edge Hybrid Cloud environment supporting various use cases like OTA deployments, Driver monitoring, AI/ML and others.

Bobbycar aims to showcase an end-to-end workflow, from connecting in-vehicle components to a cloud backend, processing telemetry data in batch or as stream, training AI/ML models and deploying containers through a DevSecOps pipeline and by leveraging GitOps to the edge.

Purpose / Objectives

  • How to use Red Hat technologies to build a cloud-native Hybrid Cloud environment supporting automotive use-cases.

  • Accelerate building IoT solutions faster with Red Hat technologies.

  • Bobbycar aims to showcase the COMPLETE Red Hat Middleware stack on OpenShift in a real world IoT context.

  • Getting a more realistic hands-on experience with cloud-native development and OpenShift

Getting Started - The Installation

You can use the install.sh script to install this Solution Pattern.

Prerequisites

Before executing the install.sh script, make sure you have the following ready:

  • A running OpenShift cluster environment (OCP on-premise, ROSA, OCP on IBM Cloud, ARO, OCP Dedicated) or OpenShift Local
  • You have cluster-admin privileges for the OpenShift cluster
  • OpenShift CLI (oc)
  • Helm CLI
  • A valid Google Maps API Key
  • Gather the API and App domain of your OpenShift Cluster:
    • App domain example: apps.cluster-zxf6m.zxf6m.sandbox1856.opentlc.com
    • API domain example: api.cluster-zxf6m.zxf6m.sandbox1856.opentlc.com
  • A clone of this Git repository

Running the installation

  1. Provide the properties in install_cleanup_vars.sh, i.e.:
# The namespace to deploy the solution pattern in
NAMESPACE=bobbycar
# The clusters app domain without port
APP_DOMAIN=apps.cluster-pnc6l.pnc6l.sandbox52.opentlc.com
# The clusters api domain without port
API_DOMAIN=api.cluster-pnc6l.pnc6l.sandbox52.opentlc.com

# Google Maps API key - https://developers.google.com/maps/documentation/javascript/get-api-key
GOOGLE_API_KEY=<MyGoogleMapsApiKey>
# OpenWeatherMap API Key - https://openweathermap.org/api
OWM_WEATHER_API_KEY=<MyApiKey>
# https://www.ibm.com/products/environmental-intelligence-suite/data-packages
IBM_WEATHER_API_KEY=<MyApiKey>

# Installs OpenShift Serverless in the cluster
INSTALL_KNATIVE=true
# Installs the required namespaced operators: AMQ Streams, AMQ Broker, Datagrid, Camel-K
INSTALL_OPERATORS=true
# Deletes the BobbycarZone CRD when executing ./cleanup.sh
DELETE_CRD=true

# Helm Release names
HELM_INFRA_RELEASE_NAME=infra
HELM_APP_RELEASE_NAME=apps
HELM_SERVERLESS_RELEASE_NAME=serverless

Mandatory fields are:

  • NAMESPACE
  • APP_DOMAIN
  • API_DOMAIN
  • GOOGLE_API_KEY

The weather-api fields are optional:

  • OWM_WEATHER_API_KEY and/or
  • IBM_WEATHER_API_KEY

If you haven't installed OpenShift Serverless in your cluster, you can set INSTALL_KNATIVE=true, this will install OpenShift Serverless.

INSTALL_OPERATORS=true will install the

  • AMQ Streams
  • AMQ Broker
  • Camel-K
  • Datagrid

operators in the local namespace you'll deploy this solution pattern into.

When using OpenShift Local, you can use the following values:

NAMESPACE=bobbycar
APP_DOMAIN=apps-crc.testing
API_DOMAIN=api-crc-testing
  1. Running the install.sh script
./install.sh 

If you want to manually install Bobbycar in your own environment (step-by-step), please follow these installation instructions!

Clean up the installation

  1. Run the cleanup.sh script to uninstall the solution pattern

If you also want to remove the BobbycarZone CRD, set DELETE_CRD=true in the install_cleanup_vars.sh script.

./cleanup.sh 

Technologies used in this Solution Pattern

  • RH OpenShift, Enterprise Kubernetes
  • RH OpenShift Serverless, based on Knative
  • RH Runtimes, Quarkus
  • RH AMQ Broker, MQTT
  • RH AMQ Streams, Apache Kafka
  • RH Fuse, Apache Camel-K
  • RH Datagrid, Distributed Caching
  • RH OpenShift Pipelines
  • RH CodeReady Workspaces
  • RH OpenJDK
  • Angular, Ionic
  • Gogs, Nexus, Sonarqube

bobbycar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar

bobbycar's Issues

install.sh improvements add the following to install.sh

The following snippets would do the trick from issue #49 in the install.sh script

#!/usr/bin/bash

# the log function exists in install.sh already and can be removed
log() {
        echo ""
        echo "#### $*"
}
# End of functions which are available in install.sh

# Variables
# $PKG for the package name

# Check for HELM and curl the current version if not available
# curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm
# chmod 755 /usr/local/bin/helm

inst_helm() {
        log "INSTALL $PKG"
        log "Start curl"
        curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm
        chmod 755 /usr/local/bin/helm
}

# Check for helm
PKG=helm
which $PKG >/dev/null 2>&1
if [ $? -eq 0 ]; then
    log "Found $PKG - we move on"
else
    log "$PKG not found - starting installation"
    inst_helm
fi

helm charts - Resolution Failed

Hello

trying to install the operators but unfortunately the subscription is failing with the operators version not found - see below

oc -n openshift-operator-lifecycle-manager logs -f $(oc -n openshift-operator-lifecycle-manager get pods -l app=catalog-operator -o=custom-columns=:metadata.name --no-headers) | grep ResolutionFailed
I0726 11:05:26.495368 1 event.go:282] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"bobbycar", UID:"ddcd06f8-bd87-45d5-a8d2-a90ceb9cbb72", APIVersion:"v1", ResourceVersion:"288160", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' constraints not satisfiable: no operators found with name amqstreams.v1.6.2 in channel stable of package amq-streams in the catalog referenced by subscription amq-streams, subscription amq-streams exists
I0726 11:05:26.511488 1 event.go:282] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"bobbycar", UID:"ddcd06f8-bd87-45d5-a8d2-a90ceb9cbb72", APIVersion:"v1", ResourceVersion:"289488", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' constraints not satisfiable: no operators found with name red-hat-camel-k-operator.v1.2.1 in channel techpreview of package red-hat-camel-k in the catalog referenced by subscription red-hat-camel-k, subscription red-hat-camel-k exists
I0726 11:05:26.542521 1 event.go:282] Event(v1.ObjectReference{Kind:"Namespace", Namespace:"", Name:"bobbycar", UID:"ddcd06f8-bd87-45d5-a8d2-a90ceb9cbb72", APIVersion:"v1", ResourceVersion:"289488", FieldPath:""}): type: 'Warning' reason: 'ResolutionFailed' constraints not satisfiable: no operators found with name red-hat-camel-k-operator.v1.2.1 in channel techpreview of package red-hat-camel-k in the catalog referenced by subscription red-hat-camel-k, subscription red-hat-camel-k exists

camel-k 1.6.10 on OCP 4.12 fails

This is potentially a camel-k bug, but it's not my area, so I thought I'd at least mention it here ;)
I was trying the latest bobbycar on OCP 4.12.12 and noticed the camel-k pod failing with:

{"level":"error","ts":1682181551.5962222,"logger":"cmd","msg":"manager exited non-zero","error":"no matches for kind \"CronJob\" in version \"batch/v1beta1\"","stacktrace":"github.com/apache/camel-k/pkg/cmd/operator.exitOnError\n\tgithub.com/apache/camel-k/pkg/cmd/operator/operator.go:165\ngithub.com/apache/camel-k/pkg/cmd/operator.Run\n\tgithub.com/apache/camel-k/pkg/cmd/operator/operator.go:151\ngithub.com/apache/camel-k/pkg/cmd.(*operatorCmdOptions).run\n\tgithub.com/apache/camel-k/pkg/cmd/operator.go:54\ngithub.com/apache/camel-k/vendor/github.com/spf13/cobra.(*Command).execute\n\tgithub.com/apache/camel-k/vendor/github.com/spf13/cobra/command.go:856\ngithub.com/apache/camel-k/vendor/github.com/spf13/cobra.(*Command).ExecuteC\n\tgithub.com/apache/camel-k/vendor/github.com/spf13/cobra/command.go:960\ngithub.com/apache/camel-k/vendor/github.com/spf13/cobra.(*Command).Execute\n\tgithub.com/apache/camel-k/vendor/github.com/spf13/cobra/command.go:897\nmain.main\n\tcommand-line-arguments/main.go:47\nruntime....

I assume 1.6.10 just assumes older k8s where CronJob/v1beta1 was still a thing. It became stable with k8s 1.21. I upgraded the camel-k operator to the 1.10.x channel and the pod did come up correctly (exact version was 1.10.0+0.1679561624.p). I suppose this is a plain bug in camel-k because according to https://access.redhat.com/labs/ocpouic/?operator=red-hat-camel-k&&ocp_versions=4.10,4.11,4.12 1.6.x is still supported on 4.12.

Feel free to close this, it is more of a heads-up than anything else ;)

Bobbycar $NAMESPACE is not being created

The Bobbycar $NAMESPACE is not being created when INSTALL_OPERATORS=false ...

if [[ "$INSTALL_OPERATORS" == true ]]; then
log "Creating namespace $NAMESPACE for Bobbycar demo"
oc new-project "$NAMESPACE" || true

Maybe just moving the oc new-project command in front of the block will do ... ignoring the error message if $NAMESPACE already exists ...

install.sh improvements txt based

Hi Ortwin.
See my comments marked with @ortwin.

  • missing helm can be solved in the install.sh #50
  • the weather API needs a NULL value as default

Preparation tasks

Prepare your bastion environment:

You can use the install.sh script to simply install the demo.

Upfront running the install.sh script you need on your bastion host:

What you will need is:

  • oc client
  • helm installed
  • a local copy of the GIT repo
  • Gather information for install.sh

oc client installation

Please follow the latest documentation to have an oc client available on your bastion host: https://docs.openshift.com/container-platform/4.8/cli_reference/openshift_cli/getting-started-cli.html

HELM installation

@ortwin: HELM muss da sein, daher koennte man das auch in der install.sh abfangen #50 ...

As we currently rely on HELM charts for the deployment of our environment, please make sure to have the latest HELM release available on your bastion host by following the below procedure:

curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm

chmod 755 /usr/local/bin/helm

A local GIT copy

Clone the GIT repo to your bastion host. Feel free to use your preferred method of choice ( ssh/https). In this example https was the easiest way.

git clone https://github.com/sa-mw-dach/bobbycar.git

Gather information for install.sh

With the GIT clone you have the following scripts available:

.
├── cleanup.sh
├── install_cleanup_vars.sh
├── install.sh
└── README.md

Please add installation information to install_cleanup_vars.sh

@ortwin: Die Weather API KEY values sollten einen Inhalt haben "" , weil sonst das install.sh fehl schlägt mit einem NIL Fehler

NAMESPACE=bobbycar
APP_DOMAIN=<e.g apps.cluster-pnc6l.pnc6l.sandbox52.opentlc.com>
API_DOMAIN=<e.g. api.cluster-pnc6l.pnc6l.sandbox52.opentlc.com>

GOOGLE_API_KEY=<add your information>
OWM_WEATHER_API_KEY=""
IBM_WEATHER_API_KEY=""

Installation

Once you are done - you are ready to start the installation

./install.sh

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.