Red Hat Training
A Red Hat training course is available for Red Hat Fuse
6.4. Profile Versions
Every profile has at least one version. When assigning a profile to a container, you actually assign both the profile and the version. The
fabric-agent, will choose the defined version and retrieve all the information provided by the specific version of the profile.
Any change to a profile takes immediate effect. This means that any container using a profile that was just modified will pick up the change immediately. It is recommended that you create a new version of a profile whenever you need to make changes. You can then upgrade containers to use the new version. This enables you to perform atomic updates, test updates on specific containers, and possibly roll back to the previous version, if you encounter any problems.
Karaf does not handle leading and trailing zeros in version numbers. Numbers such as 1.10, 01.1, 1.1 will all be interpreted as 1.1. When specifying version numbers, any numbers with leading or trailing zeros must be enclosed in double quotes. For example, "1.10". This will force the number to be interpreted as presented.
Creating a new version
You can create a new version using the
fabric:version-createcommand (analogous to creating a new branch in the underlying Git repository). The default version is 1.0. To create version 1.1, enter the following command:
To note what is changing in the new version, include the --description argument and enclose the text within double quotes; for example,
fabric:version-create --description "expanding all camel routes" 1.1.
After the 1.1 version is created, a new instance of every profile is created for the new version (copied from the previous latest version, which was 1.0). Now you can display or modify the 1.1 version of each profile. For example, enter the following command to display the details of the
fabric:profile-display --version 1.1 feature-camel
Initially, the output is identical to the 1.0 version of the profile, because we have not yet modified the new version of the profile. But how do you modify a specific version of a profile? All you need to do is to invoke the
fabric:profile-editcommand, specifying the version right after the profile argument. For example, to add the
camel-jcloudsfeature to version 1.1 of the
feature-camelprofile, enter the following command:
fabric:profile-edit --feature camel-jclouds feature-camel 1.1
The changes made to version 1.1 of the profile do not (yet) affect any of your existing containers. The changes do not take effect until you upgrade your containers to use the 1.1 version.
Rolling upgrades and rollbacks
Fabric provides commands for upgrading (incrementing the effective version) and rolling back (decrementing the effective version) the profiles assigned to a container. For example, to upgrade the
mycontainercontainer to the 1.1 version, invoke the
fabric:container-upgradecommand as follows:
fabric:container-upgrade 1.1 mycontainer
The preceding command makes
mycontainerto use version 1.1 of all the profiles currently assigned to it.
If for any reason you want to roll back to the previous version, you can invoke the
fabric:container-rollbackcommand, as follows:
fabric:container-rollback 1.0 mycontainer
It is strongly recommended that you test any profile changes on a single container, before applying the changes to the whole cluster. Applying an upgrade to all containers can be achieved by specifying the
--alloption, as follows:
fabric:container-upgrade --all 1.1 mycontainer