Chapter 15. Patching
15.1. Patching a Container in a Fabric
Abstract
In a fabric patches are applied to profiles and the patched version of the profile is applied to the container. The management console is the recommended tool for patching containers in a fabric. The fabric shell also has the commands needed to apply a patch and roll it out to running containers.
Overview
The bundles loaded by a container in a fabric are controlled by the container's Fabric Agent. The agent inspects the profiles applied to the container to determine what bundles to load, and the version of each bundle, and then loads the specified version of each bundle for the container.
A patch typically includes a new version of one or more bundles, so to apply the patch to a container in a fabric you need to update the profiles applied to it. This will cause the Fabric Agent to load the patched versions of the bundles.
The management console is the recommended tool for patching containers in a fabric. However, the command console's fabric shell also provides the commands needed to patch containers running in a fabric.
Is it necessary to patch the underlying container?
In general, when you want to patch a fabric, it is not necessary to patch the underlying container as well (for example, by following the instructions in ???). Fabric has its own mechanisms for distributing patch artefacts (for example, using a git repository for the profile data, and Apache Maven for the OSGi bundles), which are independent of the underlying container installation.
Note
In exceptional cases, however, it might be necessary to patch the underlying container (for example, if there was an issue with the
fabric:create
command). Always read the patch README
file to find out whether there are any special steps required to install a particular patch.
Using the management console
The management console is the easiest and most verbose method of patching containers in a fabric. Its Patching tab uploads patches to a fabric's Maven repository and applies the patch to a specified profile version. You can then use the management console to roll the patch out to all of the containers in the fabric.
See chapter "Patching a Fabric" in "Management Console User Guide" for more information.
Using the command console
The Red Hat JBoss Fuse command console can also be used to patch containers running in a fabric. To patch a fabric container:
- Before you proceed to install the patch, make sure to read the text of the
README
file that comes with the patch, as there might be additional manual steps required to install a particular patch. - Create a new version, using the
fabric:version-create
command:JBossFuse:karaf@root> fabric:version-create 1.1 Created version: 1.1 as copy of: 1.0
ImportantThe version name must be a pure numeric string, such as1.1
,1.2
,2.1
, or2.2
. You cannot incorporate alphabetic characters in the version name (such as1.0.patch
). - Apply the patch to the new version, using the
fabric:patch-apply
command. For example, to apply theactivemq.zip
patch file to version1.1
:JBossFuse:karaf@root> fabric:patch-apply --version 1.1 file:///patches/activemq.zip
- Upgrade the container using the
fabric:container-upgrade
command, specifying which container you want to upgrade. For example, to upgrade theroot
container, enter the following command:JBossFuse:karaf@root> fabric:container-upgrade 1.1 root Upgraded container root from version 1.0 to 1.1
ImportantIt is recommended that you upgrade only one or two containers to the patched profile version, to ensure that the patch does not introduce any new issues. When you are certain that the patch works as expected, upgrade the remaining containers in the fabric. - You can check that the new patch profile has been created using the
fabric:profile-list
command, as follows:BossFuse:karaf@root> fabric:profile-list --version 1.1 | grep patch default 0 patch-activemq-patch patch-activemq-patch
Where we presume that the patch was applied to profile version 1.1.TipIf you want to avoid specifying the profile version (with--version
) every time you invoke a profile command, you can change the default profile version using thefabric:version-set-default Version
command.You can also check whether specific JARs are included in the patch, for example:JBossFuse:karaf@root> list | grep -i activemq [ 131] [Active ] [Created ] [ ] [ 50] activemq-osgi (5.9.0.redhat-61037X) [ 139] [Active ] [Created ] [ ] [ 50] activemq-karaf (5.9.0.redhat-61037X) [ 207] [Active ] [ ] [ ] [ 60] activemq-camel (5.9.0.redhat-61037X)