Search

Chapter 3. Upgrading Fuse on Apache Karaf

download PDF

3.1. Upgrading Overview

The Fuse on Apache Karaf upgrade mechanism enables you apply fixes to an Apache Karaf container without needing to reinstall an updated version of Fuse on Karaf. It also allows you to roll back the upgrade, if the upgrade causes problems with your deployed applications.

The upgrade installer file is the very same file that you would use to make a fresh installation of Fuse on Apache Karaf. To obtain the upgrade installer file, go to the Downloads page of the Red Hat customer portal and download the latest version of the installation archive for Fuse on Apache Karaf (for example, fuse-karaf-7.1.0.fuse-710023-redhat-00001.zip).

3.2. Upgrade procedures for Fuse on Karaf

3.2.1. Impact of upgrading

The upgrade mechanism can make updates to any installation files including bundle JARs and static files (including, for example, configuration files under the etc/ directory). The Fuse on Apache Karaf upgrade process:

  • Updates any files, including bundle JARs, configuration files, and any static files.
  • Patches both the current container instance (and its runtime storage under the data/ directory) and the underlying installation. Hence, patches are preserved after deleting a container instance.
  • Updates all of the files related to Karaf features, including the features repository files and the features themselves. Hence, any features installed after the rollup patch will reference the correct patched dependencies.
  • If necessary, updates configuration files (for example, files under etc/), automatically merging any configuration changes you have made with the configuration changes made by the patch. If merge conflicts occur, see the patch log for details of how they are handled.
  • Most of the merge conflicts are resolved automatically. For example, the patch mechanism detects conflicts at property level for the property files. It detects whether it was a user or patch that changed any property. The change is preserved, if only one side changed the property.
  • Tracks all of the changes made to the installation (including to static files), so that it is possible to roll back the patch.

    Note

    The rollup patching mechanism uses an internal git repository (located under patches/.management/history) to track the changes made.

3.2.2. Upgrading the Karaf container

To upgrade a standalone Apache Karaf container:

  1. Make a full backup of your Fuse on Apache Karaf installation before upgrading.
  2. Start the container, if it is not already running. If the container is running in the background (or remotely), connect to the container using the SSH console client, bin/client.
  3. Add the upgrade installer file to the container’s environment by invoking the patch:add command. For example, to add the fuse-karaf-7.1.0.fuse-710023-redhat-00001.zip upgrade installer file:

    patch:add file:///path/to/fuse-karaf-7.1.0.fuse-710023-redhat-00001.zip
  4. Run the patch:update command. There is no need to restart the container.

    karaf@root()> patch:update
    Current patch mechanism version: 7.0.0.fuse-000191-redhat-1
    New patch mechanism version detected: 7.1.0.fuse-710023-redhat-00001
    Uninstalling patch features in version 7.0.0.fuse-000191-redhat-1
    Installing patch features in version 7.1.0.fuse-710023-redhat-00001
  5. Invoke the patch:list command to display a list of upgrade installers. In this list, the entries under the [name] heading are upgrade IDs. For example:

    karaf@root()> patch:list
    [name]                                    [installed] [rollup] [description]
    fuse-karaf-7.1.0.fuse-710023-redhat-00001 false       true     fuse-karaf-7.1.0.fuse-710023-redhat-00001
  6. Simulate the upgrade by invoking the patch:simulate command and specifying the upgrade ID for the upgrade that you want to apply, as follows:

    karaf@root()> patch:simulate fuse-karaf-7.1.0.fuse-710023-redhat-00001
    INFO : org.jboss.fuse.modules.patch.patch-management (226): Installing rollup patch "fuse-karaf-7.1.0.fuse-710023-redhat-00001"
    ========== Repositories to remove (10):
     - mvn:io.hawt/hawtio-karaf/2.0.0.fuse-000172-redhat-1/xml/features
    ...
    ========== Repositories to add (10):
     - mvn:io.hawt/hawtio-karaf/2.0.0.fuse-710018-redhat-00002/xml/features
    ...
    ========== Repositories to keep (7):
     - mvn:org.apache.activemq/artemis-features/2.4.0.amq-711002-redhat-1/xml/features
    ...
    ========== Features to update (100):
    [name]                         [version]                        [new version]
    aries-blueprint                4.2.0.fuse-000237-redhat-1       4.2.0.fuse-710024-redhat-00002
    ...
    ========== Bundles to update as part of features or core bundles (113):
    [symbolic name]                                                [version]                        [new location]
    io.hawt.hawtio-log                                             2.0.0.fuse-000172-redhat-1       mvn:io.hawt/hawtio-log/2.0.0.fuse-710018-redhat-00002
    ...
    ========== Bundles to reinstall as part of features or core bundles (110):
    [symbolic name]                                                [version]                        [location]
    com.fasterxml.jackson.core.jackson-annotations                 2.8.11                           mvn:com.fasterxml.jackson.core/jackson-annotations/2.8.11
    ...
    Simulation only - no files and runtime data will be modified.

    This generates a log of the changes that will be made to the container when the upgrade is performed, but will not make any actual changes to the container. Review the simulation log to understand the changes that will be made to the container.

  7. Upgrade the container by invoking the patch:install command and specifying the upgrade ID for the upgrade that you want to apply. For example:

    karaf@root()> patch:install fuse-karaf-7.1.0.fuse-710023-redhat-00001
  8. Validate the upgrade, by searching for one of the upgrade artifacts. For example, if you had just upgraded Fuse 7.0.0 to Fuse 7.1.0, you could search for bundles with the build number, 710023, as follows:

    karaf@root()> bundle:list -l | grep 710023
     22 │ Active │  80 │ 7.1.0.fuse-710023-redhat-00001  │ mvn:org.jboss.fuse.modules/fuse-pax-transx-tm-narayana/7.1.0.fuse-710023-redhat-00001
    188 │ Active │  80 │ 7.1.0.fuse-710023-redhat-00001  │ mvn:org.jboss.fuse.modules.patch/patch-commands/7.1.0.fuse-710023-redhat-00001

After upgrading, you also see the new version and build number in the Welcome banner when you restart the container.

3.2.3. Rolling back an upgrade

Occasionally an upgrade might not work or might introduce new issues to a container. In these cases, you can easily roll back the upgrade and restore your system to its previous state using the patch:rollback command, as follows:

  1. Invoke the patch:list command to obtain the upgrade ID, UPGRADE_ID, of the most recently installed patch.
  2. Invoke the patch:rollback command, as follows:

    patch:rollback UPGRADE_ID

    In some cases the container needs to restart to roll back the upgrade. In these cases, the container restarts automatically. Due to the highly dynamic nature of the OSGi runtime, during the restart you might see some occasional errors related to incompatible classes. These errors are related to OSGi services that have just started or stopped and can be safely ignored.

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.