Chapter 7. Getting Started with Fuse on OpenShift


Fuse on OpenShift (the name for Fuse Integration Services since 7.0) enables you to deploy Fuse applications on OpenShift Container Platform.

Important

For Fuse Integration projects (Fuse on OpenShift projects), Fuse Tooling requires installation of the Red Hat Container Development Kit (CDK) v3.x. See the 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 Fuse Integration 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 Fuse Integration projects created using the tooling to remote OpenShift servers, this chapter describes creating and deploying Fuse Integration projects to a virtual OpenShift instance, installed locally using the Red Hat Container Development Kit (CDK) v3.x.

The following sections describe how to create and deploy your first Fuse Integration project:

Note

You can also run a Fuse Integration 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 Integration project (Part II, “Debugging Routing Contexts”) to expose and fix any logic errors in the routing context.

7.1. 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 by selecting Window Perspective Open Perspective Fuse Integration.

    Note

    If a view that is described in this procedure is not open, you can open it by selecting Window Show View Other and then select the name of the view that you want to open.

  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 Servers view to open the context menu, and then select New Server to open the Define a New Server wizard.

    DefNewSrvCDK
  3. Select Red Hat JBoss Middleware Red Hat Container Development Kit 3.2+.

    Accept the defaults for:

    • Server’s hostname — localhost
    • Server name — Container Development Environment
  4. Click Next to open the Red Hat Container Development Environment page.
  5. Next to MiniShift Binary, click Browse, navigate to the location where you installed the Red Hat Container Development Kit 3.x and then 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.2+ [Stopped, Synchronized] appears in the Servers view. Container Development Environment 3.2+ is the default server name when you add a CDK 3.x server.

7.2. 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 Section 7.6, “Accessing the OpenShift web console”.

7.3. Creating a new OpenShift project

When you deploy your Fuse Integration 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 New Project 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
  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.

7.4. Creating a new Fuse Integration project

Before you create a new Fuse Integration project, you should enable staging repositories. This is needed because some Maven artifacts are not in default Maven repositories. To enable staging repositories, select Window Preferences Fuse Tooling Staging Repositories.

To create a Fuse Integration 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, type 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.

  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 Integration 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:

7.5. Deploying the Fuse Integration 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 As Run Configurations to open the Run Configurations wizard.
  3. In the sidebar menu, select Maven Build Deploy <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 that you used for the OpenShift project when you created it (OpenShift project name in Section 7.3, “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.

7.6. 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.

    • Username - developer
    • Password - developer
  • 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.

    • Username - admin
    • Password - admin

For more information on using the OpenShift web console, see Getting Started Guide.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.