How can I manually remove machines from a load balancer during a Octopus Deploy deployment?

Sometimes “trust me, this works” isn’t going to cut it. There is a need to build trust in a system. In addition, some applications don’t make it easy to automate. Case in point, if an application is sitting behind a load balancer, but there isn’t enough time to write a script to remove a server from the load balancer, and add it back in.

Is it possible to still leverage Octopus Deploy while still having manual removal of servers from a load balancer? How would I know which server to remove?

For this example, we will be leveraging the rolling deployments example provided in the documentation.

That documentation was written with the assumption the removal/addition of a server into a load balancer is automated. But we don’t want to do that. Instead we will be using manual intervention steps.

First, we want to configure the rolling deployment to only deploy to one machine at a time.

The first step, 1.1, is running this script:

$machineName = $OctopusParameters["Octopus.Machine.Name"]

Write-Highlight "The current machine is $machineName"

The manual intervention steps are straight-forward.

During the deployment it will have multiple manual intervention steps, one for each server.

Please note, 2019.10+ releases changed around how servers are shown on the screen. You won’t need the first step printing out the machine name.
image

Sample project:
You can see an example of this here: Octopus Deploy