Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 12. Patching Fuse on OpenShift

12.1. Important Note on BOMs and Maven Dependencies

In the context of Fuse on OpenShift, applications are built entirely using Maven artifacts downloaded from the Red Hat Maven repositories. Hence, to patch your application code, all that you need to do is to edit your project’s POM file, changing the Maven dependencies to use the appropriate Fuse on OpenShift patch version.

It is important to upgrade all of the Maven dependencies for Fuse on OpenShift together, so that your project uses dependencies that are all from the same patch version. The Fuse on OpenShift project consists of a carefully curated set of Maven artifacts that are built and tested together. If you try to mix and match Maven artifacts from different Fuse on OpenShift patch levels, you could end up with a configuration that is untested and unsupported by Red Hat. The easiest way to avoid this scenario is to use a Bill of Materials (BOM) file in Maven, which defines the versions of all the Maven artifacts supported by Fuse on OpenShift. When you update the version of a BOM file, you automatically update the versions for all the Fuse on OpenShift Maven artifacts in your project’s POM.

The POM file that is generated by a Fuse on OpenShift Maven archetype or by a Fuse on OpenShift template has a standard layout that uses a BOM file and defines the versions of certain required plugins. It is recommended that you stick to this standard layout in your own applications, because this makes it much easier to patch and upgrade your application’s dependencies.

12.2. Patching Overview

You might need to perform one or more of the following tasks to bring the Fuse on OpenShift product up to the latest patch level:

Section 12.3, “Patch the Fuse on OpenShift Images”
Update the Fuse on OpenShift images on your OpenShift server, so that new application builds are based on patched versions of the Fuse base images.
Section 12.4, “Patch Application Dependencies Using the Old-Style BOM”
Update the dependencies in your project POM file, so that your application uses patched versions of the Maven artifacts.
Section 12.5, “Patch Application Dependencies Using the New-Style BOM”
Update the dependencies in your project POM file, so that your application uses patched versions of the Maven artifacts.
Section 12.6, “Patch the Fuse on OpenShift Templates”
Update the Fuse on OpenShift templates on your OpenShift server, so that new projects created with the Fuse on OpenShift templates use patched versions of the Maven artifacts.

12.3. Patch the Fuse on OpenShift Images

The Fuse on OpenShift images are updated independently of the main Fuse product. If any patches are required for the Fuse on OpenShift images, updated images will be made available on the standard Fuse on OpenShift image streams and the updated images can be downloaded from the Red Hat image registry, registry.redhat.io. Fuse on OpenShift provides the following image streams (identified by their OpenShift image stream name):

  • fuse7-java-openshift
  • fuse7-karaf-openshift
  • fuse7-eap-openshift
  • fuse7-console
  • apicurito-ui
  • fuse-apicurito-generator

These image streams are normally installed on the openshift project on the OpenShift server. To check the status of the Fuse on OpenShift images on OpenShift, login to OpenShift as an administrator and enter the following command:

$ oc get is -n openshift
NAME                                  DOCKER REPO                                                     TAGS                           UPDATED
fuse7-console                         172.30.1.1:5000/openshift/fuse7-console                         1.0,1.1,1.2                    About an hour ago
fuse7-eap-openshift                   172.30.1.1:5000/openshift/fuse7-eap-openshift                   1.1,1.2,1.0                    About an hour ago
fuse7-java-openshift                  172.30.1.1:5000/openshift/fuse7-java-openshift                  1.1,1.2,1.0                    About an hour ago
fuse7-karaf-openshift                 172.30.1.1:5000/openshift/fuse7-karaf-openshift                 1.1,1.2,1.0                    About an hour ago...
fuse-apicurito-generator              172.30.1.1:5000/openshift/fuse-apicurito-generator              1.2                            About an hour ago...
apicurito-ui                          172.30.1.1:5000/openshift/apicurito-ui                          1.2                            About an hour ago...

You can now update each image stream one at a time:

oc import-image -n openshift fuse7-java-openshift:1.2
oc import-image -n openshift fuse7-karaf-openshift:1.2
oc import-image -n openshift fuse7-eap-openshift:1.2
oc import-image -n openshift fuse7-console:1.2
oc import-image -n openshift apicurito-ui:1.2
oc import-image -n openshift fuse-apicurito-generator:1.2
Note

The version tags in the image stream have the form 1.2-<BUILDNUMBER>. When you specify the tag as 1.2, you will get the latest build in the 1.2 stream.

Note

You can also configure your Fuse applications so that a rebuild is automatically triggered whenever a new Fuse on OpenShift image becomes available. For details, see the section Setting Deployment Triggers in the OpenShift Container Platform 3.9 Developer Guide.

12.4. Patch Application Dependencies Using the Old-Style BOM

If your application pom.xml file is configured to use the old-style BOM, follow the instructions in this section to upgrade the Maven dependencies. To check whether your application is using an old-style BOM, compare the layout of your project’s pom.xml file with the examples in this section.

POM files that uses the old-style BOM have a similar layout to POM files from the previous major release of Fuse on OpenShift. As of Fuse 7.0 on OpenShift, projects generated from Maven archetypes and OpenShift templates are still using the old-style BOM by default.

12.4.1. Update Old-Style Dependencies in a Spring Boot Application

The following code fragment shows the standard layout of a POM file for a Spring Boot application in Fuse on OpenShift, highlighting some important property settings:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <spring-boot.version>1.5.16.RELEASE</spring-boot.version>
    <fabric8.version>3.0.11.fuse-720027-redhat-00001</fabric8.version>

    <!-- versions of Maven plugins -->
    <fabric8.maven.plugin.version>3.5.33.fuse-720026-redhat-00001</fabric8.maven.plugin.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-project-bom-camel-spring-boot</artifactId>
        <version>${fabric8.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>fabric8-maven-plugin</artifactId>
          <version>${fabric8.maven.plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- Core plugins -->
      ...
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        ...
        <version>${spring-boot.version}</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>openshift</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric8-maven-plugin</artifactId>
            ...
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

When it comes to patching or upgrading the application, the following version settings are important:

fabric8.version
Defines the version of the fabric8-project-bom-camel-spring-boot BOM file.
fabric8.maven.plugin.version
Defines the version of the fabric8-maven-plugin plugin. The fabric8-maven-plugin plugin is tightly integrated with each version of Fuse on OpenShift. Hence, whenever you patch or upgrade Fuse on OpenShift, it is essential to upgrade the fabric8-maven-plugin plugin to the matching version.
spring-boot.version
Defines the version of the spring-boot-maven-plugin plugin.

12.4.2. Update Old-Style Dependencies in a Karaf Application

The following code fragment shows the standard layout of a POM file for a Karaf application in Fuse on OpenShift, highlighting some important property settings:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- configure the versions you want to use here -->
    <fabric8.version>3.0.11.fuse-720027-redhat-00001</fabric8.version>
    <karaf.plugin.version>4.2.0.fuse-720061-redhat-00001</karaf.plugin.version>
    ...
    <fabric8.maven.plugin.version>3.5.33.fuse-720026-redhat-00001</fabric8.maven.plugin.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- import fabric8 platform bom first -->
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-project-bom-fuse-karaf</artifactId>
        <version>${fabric8.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <version>${karaf.plugin.version}</version>
        ...
      </plugin>
      ...
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fabric8.maven.plugin.version}</version>
        ...
      </plugin>
    </plugins>
  </build>

</project>

When it comes to patching or upgrading the application, the following version settings are important:

fabric8.version
Defines the version of the fabric8-project-bom-fuse-karaf BOM file.
fabric8.maven.plugin.version
Defines the version of the fabric8-maven-plugin plugin. The fabric8-maven-plugin plugin is tightly integrated with each version of Fuse on OpenShift. Hence, whenever you patch or upgrade Fuse on OpenShift, it is essential to upgrade the fabric8-maven-plugin plugin to the matching version.
karaf.plugin.version
Defines the version of the karaf-maven-plugin plugin.

12.4.3. Update Old-Style Dependencies in a JBoss EAP Application

The following code fragment shows the standard layout of a POM file for a JBoss EAP application in Fuse on OpenShift, highlighting some important property settings:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- WildFly-Camel versions -->
    <version.wildfly.camel>5.2.0.fuse-720023-redhat-00001</version.wildfly.camel>
    ...
  </properties>

  <!-- Dependency Management -->
  <dependencyManagement>
    <dependencies>
      <!-- WildFly Camel -->
      <dependency>
        <groupId>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel-bom</artifactId>
        <version>${version.wildfly.camel}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
</project>

When it comes to patching or upgrading the application, the following version settings are important:

version.wildfly.camel
Defines the version of the wildfly-camel-bom BOM file. By updating the BOM version to a particular patch version, you are effectively updating all of the Fuse on JBoss EAP Maven dependencies as well.

12.4.4. Available Old-Style BOM Versions

The following table shows the old-style BOM versions corresponding to different patch releases of Red Hat Fuse.

Table 12.1. Red Hat Fuse Releases and Corresponding Old-Style BOM Version

Red Hat Fuse ReleaseFabric8 BOM VersionFabric8 Maven Plugin VersionWildfly Camel BOM Version

Red Hat Fuse 7.0.0 GA

3.0.11.fuse-720027-redhat-00001

3.5.33.fuse-720026-redhat-00001

5.2.0.fuse-720023-redhat-00001

Red Hat Fuse 7.0.1 patch

3.0.11.fuse-000065-redhat-3

3.5.33.fuse-000089-redhat-4

5.1.0.fuse-000083-redhat-3

To upgrade your Spring Boot or Apache Karaf application POM to a specific Red Hat Fuse patch release, set the fabric8.version property to the corresponding BOM version, and the fabric8.maven.plugin.version property to the corresponding Fabric8 Maven plugin version.

To upgrade your Fuse on JBoss EAP application POM, set the version.wildfly.camel property to the corresponding BOM version.

To discover the latest available versions, you can check the Red Hat Maven repository directly:

12.5. Patch Application Dependencies Using the New-Style BOM

If your application pom.xml file is configured to use the new-style BOM, follow the instructions in this section to upgrade the Maven dependencies. To check whether your application is using a new-style BOM, compare the layout of your project’s pom.xml file with the examples in this section.

12.5.1. Update New-Style Dependencies in a Spring Boot Application

The following code fragment shows the standard layout of a POM file for a Spring Boot application in Fuse on OpenShift, highlighting some important property settings:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <fuse.version>7.2.0.fuse-720020-redhat-00001</fuse.version>
    ...
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fuse-springboot-bom</artifactId>
        <version>${fuse.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
  <build>
    ...
    <plugins>
      <!-- Core plugins -->
      ...
      <plugin>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        ...
        <version>${fuse.version}</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>openshift</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jboss.redhat-fuse</groupId>
            <artifactId>fabric8-maven-plugin</artifactId>
            ...
            <version>${fuse.version}</version>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

When it comes to patching or upgrading the application, the following version settings are important:

fuse.version
Defines the version of the new-style fuse-springboot-bom BOM, as well as the versions of the fabric8-maven-plugin plugin and the spring-boot-maven-plugin plugin.

12.5.2. Update New-Style Dependencies in a Karaf Application

The following code fragment shows the standard layout of a POM file for a Karaf application in Fuse on OpenShift, highlighting some important property settings:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <fuse.version>7.2.0.fuse-720020-redhat-00001</fuse.version>
    ...
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fuse-karaf-bom</artifactId>
        <version>${fuse.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
  <build>
    ...
    <plugins>
      ...
      <plugin>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>karaf-maven-plugin</artifactId>
        <version>${fuse.version}</version>
        ...
      </plugin>
      ...
      <plugin>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fuse.version}</version>
        ...
      </plugin>
    </plugins>
  </build>

</project>

When it comes to patching or upgrading the application, the following version settings are important:

fuse.version
Defines the version of the new-style fuse-karaf-bom BOM, as well as the versions of the fabric8-maven-plugin plugin and the karaf-maven-plugin plugin.

12.5.3. Update New-Style Dependencies in a JBoss EAP Application

The following code fragment shows the standard layout of a POM file for a JBoss EAP application in Fuse on OpenShift, highlighting some important property settings:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project ...>
  ...
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <fuse.version>7.2.0.fuse-720020-redhat-00001</fuse.version>
    ...
  </properties>

  <!-- Dependency Management -->
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.redhat-fuse</groupId>
        <artifactId>fuse-eap-bom</artifactId>
        <version>${fuse.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  ...
</project>

When it comes to patching or upgrading the application, the following version settings are important:

fuse.version
Defines the version of the fuse-eap-bom BOM file (which replaces the old-style wildfly-camel-bom BOM file). By updating the BOM version to a particular patch version, you are effectively updating all of the Fuse on JBoss EAP Maven dependencies as well.

12.5.4. Available New-Style BOM Versions

The following table shows the new-style BOM versions corresponding to different patch releases of Red Hat Fuse.

Table 12.2. Red Hat Fuse Releases and Corresponding New-Style BOM Version

Red Hat Fuse Releaseorg.jboss.redhat-fuse BOM Version

Red Hat Fuse 7.0.0 GA

7.2.0.fuse-720020-redhat-00001

Red Hat Fuse 7.0.1 patch

7.0.1.fuse-000008-redhat-4

To upgrade your application POM to a specific Red Hat Fuse patch release, set the fuse.version property to the corresponding BOM version.

12.6. Patch the Fuse on OpenShift Templates

You must update the Fuse on OpenShift templates to the latest patch level, to ensure that new template-based projects are built using the correct patched dependencies. Patch the Fuse on OpenShift templates as follows:

  1. You need administrator privileges to update the Fuse on OpenShift templates. Log in to the OpenShift Server as an administrator, as follows:

    oc login URL -u ADMIN_USER -p ADMIN_PASS

    Where URL is the URL of the OpenShift server and ADMIN_USER, ADMIN_PASS are the credentials of an administrator account on the OpenShift server.

  2. Install the patched Fuse on OpenShift templates. Enter the following commands at a command prompt:

    BASEURL=https://raw.githubusercontent.com/jboss-fuse/application-templates/application-templates-2.1.fuse-720018-redhat-00001
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/eap-camel-amq-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/eap-camel-cdi-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/eap-camel-cxf-jaxrs-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/eap-camel-cxf-jaxws-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/eap-camel-jpa-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/karaf-camel-amq-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/karaf-camel-log-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/karaf-camel-rest-sql-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/karaf-cxf-rest-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-amq-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-config-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-drools-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-infinispan-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-teiid-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-camel-xml-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-cxf-jaxrs-template.json
    oc replace --force -n openshift -f ${BASEURL}/quickstarts/spring-boot-cxf-jaxws-template.json
    Note

    The BASEURL points at the GA branch of the Git repository that stores the quickstart templates and it will always have the latest templates at HEAD. So, any time you run the preceding commands, you will get the latest version of the templates.