4.3. Profile Versions
Overview
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.
Creating a new version
You can create a new version using the
fabric:version-create
command (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:
fabric:version-create 1.1
Note
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
feature-camel
profile:
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-edit
command, specifying the version right after the profile argument. For example, to add the camel-jclouds
feature to version 1.1 of the feature-camel
profile, enter the following command:
fabric:profile-edit --feature camel-jclouds feature-camel 1.1
Important
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
mycontainer
container to the 1.1 version, invoke the fabric:container-upgrade
command as follows:
fabric:container-upgrade 1.1 mycontainer
The preceding command makes
mycontainer
to 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-rollback
command, 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
--all
option, as follows:
fabric:container-upgrade --all 1.1 mycontainer