A rolling deployment is appropriate for big applications that are composed of multiple independent nodes. These nodes can be as big as dedicated servers or as small as Docker containers.
This deployment technique is relatively complicated in terms of deployment orchestration. UrbanCode Deploy helps you simplify such complicated deployment processes over many related nodes with the For Each Agent step.
With UrbanCode Deploy you can create application deployment process that meet your requirements. While you design an application deployment process, you specify agents to include or exclude in the deployment process.
The For Each Agent step is a loop that runs on the selected agents in an application process. You can create a sub-process inside the For Each Agent step that can be composed of any step that is available to the overall process. The loop has a setting to limit the number of agents to run on at the same time, so you can set it to deploy agents simultaneously, one at a time, two at a time, and so on.
For example, the following environment has three database nodes and three web application nodes. The database nodes host a database component, and the web nodes host a web component.
Suppose that you want to first update all database nodes one at a time and run an automated test each time. Then, you want to update all web nodes simultaneously. In this case, you must create two For Each Agent loops: one for the database nodes and one for the web nodes.
- Create an application process as below:In this example, we have two For Each Agent steps – one for running an Install Component step for the database component and another for running an Install Component step for the web component.
If the update is long or error-prone, you could also include steps that remove the nodes from the load-balancer, so no traffic goes to it during the deployment, and the traffic is restored when the deployment is successful.
- Set the properties for the Install Component step to perform on the components (database and web). To learn about how to set these properties, refer to the specific UrbanCode Deploy plug-in information.
- Set the properties for each of the For Each Agent loop:
Property Description Limit to Resource Tags A list of resource tags that limit the container.
The subprocess runs only on the agent resources that have one or more of the specified resource tags.
Max Concurrent Agents The maximum number of agents that run the subprocess at a time.
- To deploy all agents simultaneously, specify -1.
- To deploy the agents one by one, set the value to 1.
Similarly, you can specify any integer to limit the number of agents to deploy at once in rolling deployments.
The server attempts to resolve the value to an integer. If the value does not resolve to an integer, then the -1 value is used by default. You can use a property in this field, if the property resolves to an integer.
- Now, go back to your application environment and run the application process.
The For Each Agent step running the database component process runs on all agents that have a child component resource for the database component. Similarly, the For Each Agent step running the web component process runs on all agents with the web component.