Goals

  • Benefits of Fuse on OpenShift Benefits
  • Understanding administrative tasks for Fuse on OpenShift
  • Explaining how to start developing for Fuse on OpenShift

Benefits of Fuse on OpenShift

  • Native integration with Docker, Kubernetes, OpenShift
  • Transparency in platform changes for developers
  • Self-service, scaling, CI/CD for administrators
  • Application runtime built for microservice deployments

Administrator Tasks

The main administrative tasks will typically be:

Installing Fuse imagestreams and templates on the OpenShift 4.x server

  • Setting up the Fuse Console on OpenShift 4.x
  • Installing API Designer on OpenShift 4.x - (Apicurio) (Optional, through OperatorHub)

Installing Fuse imagestreams and templates on the OpenShift 4.x server

ImageStrams is an OpenShift API object that represents single virtual view of related images.

  • For Installing Fuse imagestreams and templates, you must have the administrator role for the OpenShift project.
  1. Type of Red Hat Fuse 7 images:
  2. Install Red Hat Fuse 7 images:
    You can refer to script for installing image streams and templates.
  3. fuse-karaf-openshift: Camel applications based on Karaf
  4. fuse-java-openshift: Camel applications based on standalone Java™ flat file or Spring Boot
  5. fuse-eap-openshift: Camel applications based on JBoss EAP

Setting up the Fuse Console on OpenShift 4.x

On OpenShift 4.x, you can choose one of these Fuse Console deployment options:

Cluster — The Fuse Console can discover and connect to Fuse applications deployed across multiple namespaces (projects) on the OpenShift cluster. To deploy this template, you must have the administrator role for the OpenShift cluster.

  1. Namespace — The Fuse Console has access to a specific OpenShift project (namespace). To deploy this template, you must have the administrator role for the OpenShift project.

Getting Started for Developers

Maven Archetypes

Used to generate new project with required resources and POM dependencies

Archetype catalog located in Maven repositories:

Archetype types

Karaf & Spring Boot 1.5

Example command to create project:

mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \ -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.0.fuse-750020-redhat-00002/archetypes-catalog-2.2.195.redhat-000032-archetype-catalog.xml \ -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \ -DarchetypeVersion=2.2.0.fuse-750020-redhat-00002 \ -DarchetypeArtifactId=<archetype-name>

Table 1. Available Archetypes

 

Archetype Name

Template Application Created

 

spring-boot-camel-archetype

Demonstrates how to use Apache Camel with Spring Boot based on a fabric8 Java base image.

spring-boot-camel-amq-archetype

Demonstrates how to connect a Spring Boot application to an ActiveMQ broker and use JMS messaging between two Camel routes using Kubernetes or OpenShift.

spring-boot-camel-config-archetype

Demonstrates how to configure a Spring Boot application using Kubernetes ConfigMaps and Secrets.

spring-boot-camel-drools-archetype

Demonstrates how to use Apache Camel to integrate a Spring Boot application running on Kubernetes or OpenShift with a remote Kie Server.

spring-boot-camel-infinispan-archetype

Demonstrates how to connect a Spring Boot application to a JBoss Data Grid or Infinispan server using the Hot Rod protocol.

spring-boot-camel-rest-3scale-archetype

Demonstrates how to use Camel’s REST DSL to expose a RESTful API and expose it to 3scale.

spring-boot-camel-rest-sql-archetype

Demonstrates how to use SQL via JDBC along with Camel’s REST DSL to expose a RESTful API.

spring-boot-camel-xa-archetype

Spring Boot, Camel, and XA Transactions. This example demonstrates how to run a Camel Service on Spring Boot that supports XA transactions on two external transactional resources: a JMS resource (A-MQ) and a database (PostgreSQL). This quickstart requires the PostgreSQL database and the A-MQ broker have been deployed and running first; one simple way to run them is to use the templates provided in the Openshift service catalog.

spring-boot-camel-xml-archetype

Demonstrates how to configure Camel routes in Spring Boot via a Blueprint configuration file.

spring-boot-cxf-jaxrs-archetype

Demonstrates how to use Apache CXF with Spring Boot based on a fabric8 Java base image. The quickstart uses Spring Boot to configure an application that includes a CXF JAXRS endpoint with Swagger enabled.

spring-boot-cxf-jaxws-archetype

Demonstrates how to use Apache CXF with Spring Boot based on a fabric8 Java base image. The quickstart uses Spring Boot to configure an application that includes a CXF JAXWS endpoint.

karaf2-cxf-rest-archetype

RESTful web service example using CXF

karaf2-camel-rest-sql-archetype

Camel example using REST DSL with SQL database

karaf2-camel-amq-archetype

ActiveMQ and Camel example

karaf2-camel-log-archetype

Camel log example

 

Spring Boot 2




Example command to create project:

mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \ -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.0.fuse-sb2-750011-redhat-00006/archetypes-catalog-2.2.0.fuse-sb2-750011-redhat-00006-archetype-catalog.xml \ -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \ -DarchetypeVersion=2.2.0.fuse-sb2-750011-redhat-00006 \ -DarchetypeArtifactId=<archetype-name>

 

Table 2. Available Archetypes

 

Archetype Name

Template Application Created

 

spring-boot-camel-archetype

Demonstrates how to use Apache Camel with Spring Boot based on a fabric8 Java base image.

spring-boot-camel-amq-archetype

Demonstrates how to connect a Spring Boot application to an ActiveMQ broker and use JMS messaging between two Camel routes using Kubernetes or OpenShift.

spring-boot-camel-drools-archetype

Demonstrates how to use Apache Camel to integrate a Spring Boot application running on Kubernetes or OpenShift with a remote Kie Server.

spring-boot-camel-infinispan-archetype

Demonstrates how to connect a Spring Boot application to a JBoss Data Grid or Infinispan server using the Hot Rod protocol.

spring-boot-camel-rest-3scale-archetype

Demonstrates how to use Camel’s REST DSL to expose a RESTful API and expose it to 3s750029cale.

spring-boot-camel-rest-sql-archetype

Demonstrates how to use SQL via JDBC along with Camel’s REST DSL to expose a RESTful API.

spring-boot-camel-xml-archetype

Demonstrates how to configure Camel routes in Spring Boot via a Blueprint configuration file.

spring-boot-cxf-jaxrs-archetype

Demonstrates how to use Apache CXF with Spring Boot based on a fabric8 Java base image. The quickstart uses Spring Boot to configure an application that includes a CXF JAXRS endpoint with Swagger enabled.

spring-boot-cxf-jaxws-archetype

Demonstrates how to use Apache CXF with Spring Boot based on a fabric8 Java base image. The quickstart uses Spring Boot to configure an application that includes a CXF JAXWS endpoint.

 

Set Up Maven Archetype Catalog in JBoss Developer Studio/Code Ready

  1. From JBoss Developer Studio, select Preferences.
  2. Select Maven → Archetypes.
  3. Select Add Remote Catalog and complete the fields with these values:

 

 

Packaging Process

 

 

Deployment with S2I

Workflow process for S2I Code Workflow
  1. Code pulled from Git repository, or from developer machine after compression, and copied onto S2I builder image
  2. S2I builder image pulled from registry into node where build takes place
  3. Maven build takes place, pulling required dependencies and generating application artifacts
  4. Docker image created, based on Red Hat Fuse S2I image and containing application artifacts
  5. Docker image pushed into OpenShift registry
  6. Container started on OpenShift node
Workflow process for S2I Binary Workflow

It is called binary because you bypass Git repository, and do the build on your local machine and then push the generated binary directly to OpenShift.

Table 3. S2I Binary Build Types

Build Type

Build From

Note

 

from-dir

Specified directory


oc start-build BUILDCONFIG --follow --from-dir=.

from-repo

Local Git repository


oc start-build BUILDCONFIG --follow --from-repo=.

from-file

Project JAR archive


oc start-build BUILDCONFIG --follow --from-file=.

Fabric8

Fabric8 makes it easy to create Microservices, build, test, and deploy them via Continuous Delivery pipelines then run and manage them with Continuous Improvement and ChatOps.