Openshift Route Diagram Small

Experiment with FIS 2.0 with the Absolute Minimum Setup

Introduction

Fuse Integration Services 2.0 (FIS 2.0) for Openshift introduces a number of new features. In my opinion, the most exciting ones are the introduction of S2I binary workflow and Spring Boot support. We shall be using these 2 new features in this article. As FIS is for Openshift, as its name implies, one needs a development Openshift environment to experiment with it. There are several ways to set up a development Openshift environment on your laptop. The following are the most popular options:

  1. oc cluster up – this is a relatively new feature introduced in Openshift Origin 1.3. This option uses a containerized version of Openshift and runs it locally on your laptop. It requires Docker to run.
  2. Red Hat Development Suite (RHDS) – this development suite comes with an installer (Windows and Mac only at present) that installs JBoss Developer Studio, Red Hat Container Development Kit and all the necessary dependencies. It is based on Vagrant, VirtualBox. Openshift Enterprise and Red Hat Enterprise Linux. In contrast to option 1 which is based on Docker, RHDS is based on a virtual machine or VM.

There are already lots of information that one can find that talks about how to set up Openshift and deploy FIS-based application onto it. Just listing a few below:

https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html-single/red_hat_jboss_fuse_integration_services_2.0_for_openshift/

http://people.redhat.com/mhepburn/openshift-v3-workshop/28.%20Fuse%20Integration%20Services.md.html

https://developers.redhat.com/blog/2016/09/22/development-workflows-with-fuse-integration-services-fis/

https://blog.openshift.com/wp-content/uploads/Commons-Briefing-Modern-App-Architecture-Demo.pdf

How is this article different from the above?

In this article, I am going to show you the absolute minimum you have to do to set up an Openshift environment for experimenting with FIS, in particular, the S2I workflow and Spring Boot support. Many of the things, like setting up templates, will be skipped. The intended audience are Solution Architects and developers who just want to experiment with FIS quickly on their laptops.

 

Setting up oc cluster up Environment

To set up the ‘oc cluster up’ environment, you need to set up Docker on your Linux VM (assuming you are using a VM). If you are using Fedora, the way to do it is:

sudo dnf -y install docker-engine.x86_64

If you are using other favours of Linux, use its version of software installation tool instead. Note that the package name may be different eg, docker.io.

After installing Docker, you can follow the ‘Getting Started’ section for Linux (I assume you are using Linux, if you are using Windows, or Mac, follow specific sections for them) in the link below:

https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md#etcd-data

You can skip step 3 if you already have the Linux firewall disabled on your VM. After doing these steps, you will be able to start up your local Openshift using the command: “oc cluster up”.

Setting up Developer Studio

To develop FIS application, you will require the JBoss Developer Studio JBDS) and Maven archetypes which set up a FIS project for you. Download ‘Red Hat JBoss Developer Studio 10.3.0 Stand-alone Installer here.

 

Make sure you have Java8 installed and issue the following command to install it:

java -jar /pathToInstaller/devstudio-10.3.0.GA-installer-standalone.jar

Just answer the questions from the installer.

After installing JBDS, start it up, point it to a workspace. Set up the FIS maven archetype (think of them as project templates) as follows:

Window→Preferences→Maven→Archetypes→Add Remote Catalog

Remote Catalog
Remote Catalog

And you will be presented with the following dialog box:

Remote Catalog Dialog
Remote Catalog Dialog

Enter the following in the ‘Catalog File’ text box:

https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.195.redhat-000004/archetypes-catalog-2.2.195.redhat-000004-archetype-catalog.xml

And FIS in the Description text box and click Verify and then OK.

Creating a Simple Spring Boot Maven Project

New→Project→Maven Project

Maven Project
Maven Project

Then click next→next and you will come to this dialog box where you select FIS from Catalog and you will see a number of archetypes:

Spring Boot Camel Archetype
Spring Boot Camel Archetype

Select the Spring Boot Camel Archetype to create an example project which has a simple working camel route.

Complete the project setup by completing the archetype parameters as show:

Archetype Parameters
Archetype Parameters

Test the application locally using Spring Boot:

On left pane, select project camelexample, right click, select ‘m2 8 Maven Build’ and enter ‘spring-boot:run’ in Goals and click RUN.

Spring Boot Goal
Spring Boot Goal

And you will see the Camel example running in the Console window. All the Camel route does is output a Hello message every 5 seconds on so.

Spring Boot Run
Spring Boot Run

Now that you have you camel route running locally on Spring Boot, you can deploy it to openshift.

Deploying to Openshift using Binary S2I

Start your local Openshift environment from the command prompt by issug the command:

oc cluster up
oc cluster up
oc cluster up

Note the normal user and administrator login name and passwords.

Save the content below to a file named ‘fis-image-stream.json’

{
    "kind": "List",
    "apiVersion": "v1",
    "metadata": {
        "name": "fis-image-streams",
        "annotations": {
            "description": "ImageStream definitions for JBoss Fuse Integration Services."
        }
    },
    "items": [
        {
            "kind": "ImageStream",
            "apiVersion": "v1",
            "metadata": {
                "name": "fis-java-openshift"
            },
            "spec": {
                "dockerImageRepository": "registry.access.redhat.com/jboss-fuse-6/fis-java-openshift",
                "tags": [
                    {
                        "name": "2.0",
                        "annotations": {
                            "description": "JBoss Fuse Integration Services 2.0 Java S2I images.",
                            "iconClass": "icon-jboss",
                            "tags": "builder,jboss-fuse,java,xpaas",
                            "supports":"jboss-fuse:6.3.0,java:8,xpaas:1.2",
                            "version": "2.0"
                        }
                    }
                ]
            }
        },
        {
            "kind": "ImageStream",
            "apiVersion": "v1",
            "metadata": {
                "name": "fis-karaf-openshift"
            },
            "spec": {
                "dockerImageRepository": "registry.access.redhat.com/jboss-fuse-6/fis-karaf-openshift",
                "tags": [
                    {
                        "name": "2.0",
                        "annotations": {
                            "description": "JBoss Fuse Integration Services 2.0 Karaf S2I images.",
                            "iconClass": "icon-jboss",
                            "tags": "builder,jboss-fuse,java,karaf,xpaas",
                            "supports":"jboss-fuse:6.3.0,java:8,xpaas:1.2",
                            "version": "2.0"
                        }
                    }
                ]
            }
        }
    ]
}

 

From the command prompt, log in as administrator and create the image stream by issuing the commands shown in the screenshot.:

oc login -u system:admin
oc project openshift
oc create -f openshift/fis-image-streams.json

 

where openshift/fis-image-streams.json is the path to the image stream json file created earlier.

Create Image Stream
Create Image Stream

 

Now that we have created the image stream, we can login as develop and deploy our camel example. Note that after login, you are using Project ‘myproject’. You could create a new project to deploy you application in but we shall just use the myproject.

My Project
My Project

Go back to JBDS, on left pane, select project camelexample, right click, select ‘m2 8 Maven Build’ and enter ‘fabric8:deploy in Goals and click RUN. You will see the output below:

Binary S2I
Binary S2I

From your browser, login to Openshift console as developer. My OpenShift URL is https://10.0.2.15:8443/console. Your ip address was displayed when you issued ‘oc cluster up’.

Openshift Myproject
Openshift Myproject
Openshift Overview
Openshift Overview
Openshift App Pods
Openshift App Pods
Openshift Logs
Openshift Logs
Openshift Java Console
Openshift Java Console
Openshift Route Diagram
Openshift Route Diagram

Note that we do not need to create a ‘route’ for the service as it is not being accessed externally in this particular case.

You can see that all is working on your local Openshift environment. When you want to shutdown your Openshift environment, just issue the following command from the command prompt:

oc cluster down

Note that next time you start up Openshift, you have to redo everything as we have not specified the oc cluster up –host-data-dir= option when we started our Openshift environment.

Conclusion

That’s it folks for your first experiment with FIS 2.0 on your local Openshift environment. Now that you have your environment set up for FIS 2.0 development, we can start building more realistic applications. In my next article, I shall create a more realistic Camel application using FIS 2.0 and Spring Boot which can be used as a reusable FIS 2.0 Demo. SO STAY TUNED!