Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 7. Getting Started with Fuse Integration Services

Overview

Fuse Integration Services (FIS) provides a set of tools and containerized xPaaS images for developing, deploying, and managing microservices on OpenShift.

Important

For FIS projects, Fuse Tooling requires installation of the Red Hat Container Development Kit (CDK) v3.x. See Getting Started Guide for instructions. In addition to the prerequisites specified in this guide, you need to establish a Red Hat account if you do not have one. Your Red Hat user name and password are required to start the virtual OpenShift instance provided in the Red Hat Container Development Kit.

You can easily get an account by registering on the Red Hat Customer Portal. Click Account in the upper right corner of the white banner, and then click RH acctRegBut on the Login to Your Red Hat Account page.

Fuse Tooling enables you to develop and deploy FIS 2.0 projects using the s2i binary workflow. In this workflow, the tooling builds your project locally, assembles it into an image stream, then pushes the image stream to OpenShift, where it is used to build the Docker container. Once the Docker container is built, OpenShift deploys it in a pod.

Important

Fuse Tooling works only with the S2I binary workflow and only with projects based on the Spring Boot framework.

Note

Although Fuse Tooling can deploy FIS projects created using the tooling to remote OpenShift servers, this chapter describes creating and deploying FIS projects to a virtual OpenShift instance, installed locally using the Red Hat Container Development Kit (CDK) v3.x.

Creating and deploying your first Fuse FIS project involves:

Note

You can also run a Fuse FIS project as a local Camel context, see Section 6.1, “Running routes as a local Camel context”, and then connect to it in the JMX Navigator view, where you can monitor and test the routing context. You can also run the Camel debugger on a Fuse FIS project (Part II, “Debugging Routing Contexts”) to expose and fix any logic errors in the routing context.

Adding the Red Hat Container Development Kit server

To add the Red Hat Container Development Kit to the Servers view:

  1. If necessary, switch to the Fuse Integration perspective.

    Note

    If, in this or any other section in this chapter, a view described in a procedure is not open, you can open it by clicking WindowShow View → *Other → *view_name.

  2. In the Servers view, click the link No servers are available. Click this link to create a new server…​ to open the Define a New Server wizard. This link appears only when the Servers view contains no server entry.

    Otherwise, right-click in the view to open the context menu, and then select NewServer to open the Define a New Server wizard.

    DefNewSrvCDK
  3. Select Red Hat JBoss MiddlewareRed Hat Container Development Kit 3.

    Accept the defaults for:

    • Server’s host name — localhost
    • Server name — Container Development Environment
  4. Click Next to open the Red Hat Container Development Environment page.
  5. Next to Folder, click Browse, navigate to the location where you installed the Red Hat Container Development Kit 3.x and click Open.
  6. Next to Username, click Add to open the Add a Credential page.
  7. Set the credentials this way:

    • Username — Enter the name you use to log into your Red Hat account.
    • Always prompt for password — Leave as is (disabled).
    • Password — Enter the password you use to log into your Red Hat account.
  8. Click OK to return to the Red Hat Container Development Environment page, which is now populated. For example:

    CDEdefUserFolder3
  9. Click Finish. Container Development Environment 3 [Stopped, Synchronized] appears in the Servers view. Container Development Environment 3 is the default server name when you add a CDK 3.x server.

    CDEsrvStoppedSyncd

Starting the Container Development Environment (CDE) and virtual OpenShift server

Starting the Container Development Environment (CDE) also starts the virtual OpenShift server. Stopping the CDE also stops the virtual OpenShift server.

  1. In the Servers view, select Container Development Environment 3 [stopped, Synchronized], and then click run exec on the Servers menu bar.

    Console view opens and displays the status of the startup process:

    CDEstartTerminal
    Note

    On initial startup, the CDE asks whether you accept the untrusted SSL certificate. Click Yes.

    When the startup process has finished, the Servers view displays:

    CDEsrvStartedSyncd
  2. Switch to the OpenShift Explorer view.

    The virtual OpenShift server instance, developer, is also running:

    OSEopenshift devAutostart

    https://192.168.99.100:8443 is an example of a URL for the OpenShift developer web console. Your installation displays the URL for your instance. For more details, see the section called “Accessing the OpenShift Web Console”.

Creating a new OpenShift project

When you deploy your Fuse FIS project to OpenShift, it is published to the OpenShift project you create here.

  1. In the OpenShift Explorer view, right-click the developer entry, to open the context menu.
  2. Select NewProject to open the New OpenShift Project wizard.
  3. Set the new project’s properties this way:

    • In the Project Name field, enter the name for the project’s namespace on the virtual OpenShift server.

      Only lower case letters, numbers, and dashes are valid.

    • In the Display Name field, enter the name to display on the virtual OpenShift web console’s Overview page.
    • Leave the Description field as is.

      For example:

      New Project Name
  4. Click Finish.

    The new OpenShift project (in this example, New FIS Test newtest) appears in the OpenShift Explorer tab, under, in this example, developer https://192.168.99.100:8443:

    OSEnewFISprojCreated
    Note

    MyProject myproject is an initial example project included with OpenShift.

    With New FIS Test newtest selected in the OpenShift Explorer view, the Properties view displays the project’s details. For example:

    OSEnewFISprojProps
    Note

    When you deploy the project to OpenShift, the Properties view gathers and displays the same information about the project that the OpenShift web console does.

Creating a new Fuse FIS project

Before you create a new Fuse FIS project, you should enable staging repositories. This is needed because some Maven artifacts are not in default Maven repositories. To enable staging repositories, select WindowPreferencesFuse ToolingStaging Repositories.

To create a FIS project, use the Spring Boot on OpenShift template:

  1. In the Project Explorer view, right-click to open the context menu and then select New → Fuse Integration Project to open the wizard’s Choose a project name page:

    New Fuse Integration Project
  2. In the Project Name field, enter a name that is unique to the workspace you are using, for example, myFISproject.

    Accept the defaults for the other options.

  3. Click Next to open the Select a Target Runtime page:

    New Project Camel Version

    Leave the defaults for Target Runtime (No Runtime selected) and Camel Version (2.18.1.redhat-000021 (FIS 2.0 R3)).

  4. Click Next to open the Advanced Project Setup page:

    Advanced Project Setup
  5. Select the Simple log using Spring Boot - Spring DSL template.

    Advanced Project Templates
  6. Click Finish.

    Note

    Because of the number of dependencies that are downloaded for a first-time Fuse FIS project, building it can take some time.

    If the Fuse Integration perspective is not already open, Developer Studio prompts you to indicate whether you want to open it now. Click Yes.

When the build is done the Fuse Integration perspective displays the project, for example:

FIS ProjCreatedFIP

At this point, you can:

Deploying the Fuse FIS project to OpenShift

  1. In the Project Explorer view, right-click the project’s root (in this example, myFISproject) to open the context menu.
  2. Select Run AsRun Configurations to open the Run Configurations wizard.
  3. In the sidebar menu, select Maven BuildDeploy <projectname> on OpenShift (in this example, Deploy myFISproject on OpenShift) to open the project’s default run configuration:

    FIS RunCnfgMain

    Leave the default settings as they are on the Main tab.

  4. Open the JRE tab to access the VM arguments:

    FIS RunCfgJRE
  5. In the VM arguments pane, change the value of the -Dkubernetes.namespace=test argument to match the Project name you used for the OpenShift project when you created it (OpenShift project name in the section called “Creating a new OpenShift project”.

    In this example, change the default value test to newtest:

    FIS RunCfgVMargsChg

    Depending on your OpenShift configuration, you may need to modify other`VM arguments to support it:

    • -Dkubernetes.master=https://192.168.99.1:8443

      When running multiple OpenShift instances or using a remote instance, you need to specify the URL of the OpenShift instance targeted for the deployment. The URL above is an example.

    • -Dkubernetes.trust.certificates=true

      • When using the CDK, this argument is required. Leave it set to true.
      • If you are using an OpenShift instance that has a valid SSL certificate, change the value of this argument to false.
  6. Click Apply and then click Run.

    Because of the number of dependencies to download, first-time deployment can take some time. The speed of your computer and your internet connection are contributing factors. Typically, it takes 25 to 35 minutes to complete a first-time deployment.

    In the Console view, you can track the progress of the deploy process. In the following output, the entry *Pushing image 172.30.1 …​.. * indicates that the project built successfully and the application images are being pushed to OpenShift, where they will be used to build the Docker container.

    FIS ConLogSuccess1

    The Console view displays BUILD SUCCESS when deployment completes successfully:

    FIS ConLogSuccess2
  7. Switch to the OpenShift Explorer view and select New FIS Test newtest:

    OSE NewFISTestDeploy1

    In the Properties view, the Details page displays all of the project’s property values.

    OSEnewFISprojProps

    Open the other tabs (Builds, Build Configs, Deployments,…​) to view other properties of the project. The Properties view provides the same information as the OpenShift Web Console.

  8. In the OpenShift Explorer view, select camel-ose-springboot-xml to view its details in the Properties view:

    NFT camxmlPropsDetails

    Scroll through the other tabs to view other properties of the deployment configuration.

  9. In the OpenShift Explorer view, select camel-ose-springboot-xml-1-mdmtd Pod Running, and then view the details of the running instance in the Properties view:

    NFT ImageStreamPropsDetails
  10. In the OpenShift Explorer view, right-click camel-ose-springboot-xml-1-mdmtd Pod Running, and then select Pod Logs…​.

    Note

    If prompted, enter the path to the installed oc executable. It is required to retrieve pod logs.

    The Console view automatically opens, displaying the logs from the running pod:

    OSE podLogsDisplayed

    Click Close in the Console view’s menu bar to terminate the session and clear console output.

Accessing the OpenShift Web Console

Note

This information applies to Red Hat Container Development Kit installations only.

To access the OpenShift Web Console, open a browser and enter the OpenShift server’s URL, which is specific to your instance and your machine. For example, enter https://192.168.99.100:8443, in the browser’s address field.

You can log into the web console either as a developer or as an administrator, using the default credentials:

  • Default developer role

    Developer users can view only their own projects and the supplied OpenShift sample project, which demonstrates OpenShift v3 features. Developer users can create, edit and delete any project that they own that is deployed on OpenShift.

    • Usernamedeveloper
    • Passworddeveloper
  • Default administrator role

    An administrator user can view and access all projects on OpenShift (CDK). Administrator users can create, edit and delete, any project deployed on OpenShift.

    • Usernameadmin
    • Passwordadmin

For more information on using the OpenShift web console, see NameOfCDKGettingStarted}.