Chapter 14. Patching Fuse on OpenShift

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:

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.
Patch Application Dependencies using BOM
Update the dependencies in your project POM file, so that your application uses patched versions of the Maven artifacts.
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.

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

14.2. Patching 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

Procedure

  1. Fuse on OpenShift 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,1.3,1.4,1.5,1.6,1.7     About an hour ago
    fuse7-eap-openshift             172.30.1.1:5000/openshift/fuse7-eap-openshift        1.0,1.1,1.2,,1.3,1.4,1.5,1.6,1.7    About an hour ago
    fuse7-java-openshift            172.30.1.1:5000/openshift/fuse7-java-openshift       1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7     About an hour ago
    fuse7-karaf-openshift           172.30.1.1:5000/openshift/fuse7-karaf-openshift      1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7     About an hour ago
    fuse-apicurito-generator        172.30.1.1:5000/openshift/fuse-apicurito-generator   1.2,1.3,1.4,1.5,1.6,1.7             About an hour ago
    apicurito-ui                    172.30.1.1:5000/openshift/apicurito-ui               1.2,1.3,1.4,1.5,1.6,1.7             About an hour ago
  2. You can now update each image stream one at a time:

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

The version tags in the image stream have the form 1.7-<BUILDNUMBER>. When you specify the tag as 1.7, you will get the latest build in the 1.7 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 Triggering and modifying builds in the Builds OpenShift Container Platform documentation_.

14.3. Patching 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.

Procedure

  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.0.fuse-770012-redhat-00004
    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-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.

14.4. Patch application dependencies using 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.

14.4.1. Updating 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.7.0.fuse-770012-redhat-00003</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.

14.4.2. Updating 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.7.0.fuse-770012-redhat-00003</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.

14.4.3. Updating 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.7.0.fuse-770012-redhat-00003</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.

14.5. Available BOM versions

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

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

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

Red Hat Fuse 7.7 GA

7.7.0.fuse-770012-redhat-00003

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.