Perform rolling update deployments
This topic describes how to perform the rolling update deployment pattern using Deploy. This is a scalable approach that applies to any environment or any number of applications.
Deploy uses orchestrators to calculate a deployment plan and provide support for a scalable solution. For more information about orchestrators, see Types of orchestrators in Deploy. With scripting not required, the environments, the load balancer, and the application must be configured.
To perform the rolling update deployment pattern, Deploy uses a load balancer plugin and orchestrators. More than one orchestrator can be added to optimize 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: A minimum requirement for this pattern is that two versions of the software are active in the same environment at the same time. This adds requirements to the software architecture. Example: Both versions must be able to connect to the same database and database upgrades must be more carefully managed.
Tutorial
The following tutorial describes the necessary steps for performing a rolling update deployment pattern. It uses the PetClinic demo application that is shipped with Deploy.
Note: To complete this tutorial, you must have the Deploy Tomcat and the Deploy F5 BIG-IP plugins installed. For more information, see Introduction to the Deploy Tomcat plugin and Introduction to the Deploy F5 BIG-IP plugin.
1. Import a sample application
The rolling update deployment pattern can be used with any application.
To import two samples:
-
Open Deploy and click Explorer.
-
In the Library menu, hover over Applications, and click .
-
Hover over Import and click From 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 4.
-
Select PetClinic-war/2.0.
-
Click Import.
2. Prepare the nodes and setup the Infrastructure
In this procedure, you will setup the nodes that 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. Deploy will generate a deployment plan to deploy the application, group by group, in the specified order.
In this example, there are three application servers that will host the application simultaneously. You will deploy the application to Tomcat 1, Tomcat 2, and Tomcat 3.
Step up the infrastructure:
-
In the Explorer tab, go to Library, and click Infrastructure.
-
Click .
-
Create an app server 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 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, expand Applications, under 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 generated by 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 optimized, 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.
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 takes the load balancer into account and removes 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
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. 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.