Perform rolling update deployments
This guide describes how to perform the rolling update deployment pattern using XL Deploy. This is a scalable approach that will work for any environment or any number of applications.
XL Deploy uses the orchestrator feature to calculate a deployment plan and provide support for a scalable solution. With scripting not required, the environments, load balancer, and application must be configured.
To perform the rolling update deployment pattern, XL Deploy uses a load balancer plugin and orchestrators. More than one orchestrator can be added to fine-tune the generated deployment plan.
In the rolling update pattern, the application runs on several nodes. A load balancer distributes the traffic to these nodes. When updating to a new version, a node is removed from the load balancer pool and taken offline to update, one node at a time. This ensures that the application is still available because it is being served by other nodes. When the update is complete, the updated node is added to the load balancer pool again and the next node is updated, until all nodes have been updated.
Important: At a minimum, this pattern requires that two versions of the software are active in the same environment at the same time. This adds requirements to the software architecture. For example, both versions must be able to connect to the same database, and database upgrades must be more carefully managed.
Note: This guide was written using XL Deploy 7.6.
Tutorial
The following tutorial takes you through the steps involved in performing a rolling update deployment pattern. It uses the PetClinic demo application that is shipped with XL Deploy.
Note: To complete this tutorial, you must have the XL-Deploy Tomcat and the XL-Deploy F5 BIG-IP plugins installed. For more information, see Introduction to the XL Deploy Tomcat plugin and Introduction to the XL Deploy F5 BIG-IP plugin.
1. Import a sample application
The rolling update deployment pattern can be used with any application.
Import two samples:
- Open XL Deploy.
- Click Explorer.
- From the Library menu, click Applications.
- Click
.
- Rollover Import and click From XL Deploy server
- In the Package field, click the drop-down arrow.
- Select PetClinic-war/1.0.
- Click Import.
- When the import is complete, repeat steps 2 to 5.
- Select PetClinic-war/2.0.
-
Click Import.
2. Prepare the nodes and setup the Infrastructure
In this procedure, you will setup the nodes that will serve the application and ensure that they are updated in the correct order. You will use an application that is deployed to Apache Tomcat. This procedure applies to any setup.
The rolling update deployment pattern uses the deployment group orchestrator. This orchestrator groups containers and assigns each group a number. XL Deploy will generate a deployment plan to deploy the application, group by group, in the order specified.
In this example, there are three application servers that will host our application simultaneously. You will deploy the application to Tomcat 1, Tomcat 2 and Tomcat 3.
Step up the infrastructure:
- In the Explorer tab Library, click Infrastructure.
- Click
.
-
Create an appserver host:
- Rollover New, and overthere, and click SshHost.
- Name this host
Appserver Host
. - Configure this component to connect to the physical machine running the tomcat installations.
- Click Save.
-
Create three app servers:
- Click Appserver Host.
- Click
.
- From the drop-down, rollover New, and Tomcat, and click Server.
- Name this server
Appserver 1
. - Configure this server to point to the Tomcat installation directory.
- Click Save.
- Repeat step 4 twice. Name these servers
Appserver 2
andAppserver 3
. -
Create three Tomcat targets:
- Click Appserver 1.
- Click
.
- Rollover New, and Tomcat, and click VirtualHost.
- Name this target
Tomcat 1
.
- Repeat step 6 twice. Name these targets
Tomcat 2
andTomcat 3
, and configure the targets to their corresponding app server.
3. Add the servers to a group
To deploy in sequence, each Tomcat server must have its own deployment group.
- From the Infrastructure menu, double click
Tomcat 1
. - In the Development section, enter the sequence number for this rolling update into the Deployment Group number field.
-
Repeat steps 1 and 2 for
Tomcat 2
andTomcat 3
.Note: The Deployment section is available on all containers in XL Deploy.
4. Create an environment
- Click Environments.
- Click
.
- Rollover New, and click Rolling Environment.
- Name the environment
Rolling environment1
. - Go to the Common section.
-
Add the servers (
Tomcat 1
,Tomcat 2
, andTomcat 3
) to the Containers section.
5. Run your first rolling deployment
- In the Library, under Applications, and PetClinic-war click 1.0.
- Click
.
- Click Deploy.
- In the Select Environment window, select Rolling Environment1.
- Click Continue.
- In the Configure screen, press the Preview button to see the deployment plan that is generated by XL Deploy.
- From the top-left side of the screen, click Deployment Properties.
- In the Orchestrator field, type
sequential-by-deployment-group
. -
Click Add.
Note: Orchestrators modify the plan automatically. In this case, the sequential-by-deployment-group orchestrator creates a rolling deployment plan. It is also possible to stack orchestrators to create fine-tuned, scalable deployment plans.
- Click Save to update the plan.
- Click Deploy.
The above procedure will perform any rolling update deployment, at any scale.
6. Add the load balancer
While one node is being upgraded, the load balancer ensures that the node does not receive any traffic, by routing traffic to the other nodes while one is down for the upgrade.
XL Deploy supports a number of load balancers that are available as plugins. In this example you will use the F5 BigIp plugin. The procedure is the same for all load balancer plugins.
- Ensure that your architecture is as described in: 2. Prepare the nodes and set up the Infrastructure.
- Click Infrastructure.
- Rollover New, and overthere, and click SshHost.
- Name this host
BigIP Host
. - Configure the host.
- Click Save.
- Click BigIP Host.
- Click
.
- Rollover New, and F5 BigIp, and click LocalTrafficManager.
- Name this item
Traffic Manager
. -
Configure the Configuration Items (CIs) according to the load balancer plugin documentation. You now have the following infrastructure.
-
On the load balancer, add the nodes you are deploying to the Managed Servers field. Note: You are using the F5 BigIp plugin, but this property is available on any load balancer plugin.
-
Add a load balancer to the environment. In this case the Traffic Manager is added to the Rolling Environment.
-
To trigger the load balancing behavior in the plan, add another orchestrator:
sequential-by-loadbalancer-group
.
The plan now takes the load balancer into account and removes and adds the Tomcat servers from the load balancer when the node is being upgraded.
The plan is now ready for a rolling update deployment.
7. Preparing the applications for the rolling update deployment pattern
So far, you manually added the orchestrators to the deployment properties when creating the deployment.
There are two ways to configure the CIs to pick up the orchestrators automatically.
1. Setting orchestrators on the application
If the rolling update pattern applies to all environments the application is deployed to, the easiest way to configure orchestrators automatically is to configure them directly on the application that is to be deployed.
- Open the deployment package, double click PetClinic/1.0.
- In the Common section of the configuration window, add the relevant orchestrators to the Orchestrator field.
The disadvantage of this approach is that the orchestrators are hardcoded on the application and may not be required on each environment. For example, if a rolling update is only needed in the production environment but not in the QA environment.
2. Configuring orchestrators on the environment
Define the orchestrators on the environment using dictionaries:
-
Remove the orchestrator from the PetClinic application:
- Expand PetClinic.
- Double click 1.0.
- In the Common section, delete the orchestrator.
- Repeat step 1 for the remaining application.
-
Create a dictionary:
- Click Environments.
- Rollover New and click Dictionary.
- Name this dictionary
Dictionary
.
- In the dictionary configuration window, in the common section, create the following entry:
Key Value
udm.DeployedApplication.orchestrator sequential-by-deployment-group, sequential-by-loadbalancer-group
Two dictionary features are used here:
- The key maps to a fully quantified property of the application being deployed. If this property is left empty on the application, the value is taken from the dictionary.
- The value is a comma-separated list and will be mapped to a list of values.
-
Add the dictionary to Rolling Environment:
- Double click Environment.
- In the configuration window, in the Common section, add
Dictionary
to the Dictionaries field. - Click
Save
.
-
Start the deployment again.
The orchestrators are picked up and the plan is generated without having to configure anything directly on the application.