Rolling Deployments Target order

Sorry for the really stupid question but during rolling deployments how does Octopus Deploy determine the target order during the deployment?

For example here is a scenario:

Bellow are 3 web servers:

WebServer1
WebServer2
WebServer3

These sit behind a load balancer, I want to incrementally deploy to each web server starting from 1, however Octopus deploy will deploy in the following order:

WebServer2
WebServer1
WebServer3

Is there a way to change the target order?

Thanks

Doug

Hi Doug,

Not a stupid question at all. I had to delve into the code to find the answer.

The answer is: the order is undefined. We retrieve the machines from the SQL Server database without specifying an order (so SQL Server will just return them in whatever order will be fastest). There is currently no way to specify the order for a rolling deployment.

Can I ask why you wish to? Perhaps there is another way to achieve your desired result.

Regards,
Michael

Hi Michael,

Thanks for checking, basically what I am trying to do is reduce the amount of deploy steps within a project.

To keep this simple. I have 2 production servers

Web Server 1
Web Server 2

My project steps resemble the following:

  • Manual Task: Take Web Server 1 out of service
  • Deploy Nuget Package Web server 1 (Configure IIS Settings and server settings)
  • Configure IIS Application on Web Server 1
  • Configure IIS Virtual Directory on Web Server 1
  • Run PS smoke tests and configuration scripts on Web Server 1
  • Manual Task: Put Web Server 1 back in service
  • Manual Task: Take Web Server 2 out of service
  • Deploy Nuget Package Web server 2 (Configure IIS Settings and server settings)
  • Configure IIS Application on Web Server 2
  • Configure IIS Virtual Directory on Web Server 2
  • Run PS smoke tests and configuration scripts on Web Server 2
  • Manual Task: Put Web Server 2 back in service
  • Send Email notification

These servers sit behind a load balancer and each server has sticky asp.net sessions and user session needs to be drained off gracefully.

During a deployment we have to manually take servers in and out of service during the deployment to update the web server that is out of service.

Ideally I would like this to resemble the following:

  • Manual Task: Take Web Server x out of service
    - Child Step: Deploy Nuget Package Web server x (Configure IIS Settings and server settings)
    - Child Step:Configure IIS Application on Web Server x
    - Child Step:Configure IIS Virtual Directory on Web Server x
    - Child Step: Run PS smoke tests and configuration scripts on Web Server x
    - Child Step:Manual Task: Put Web Server x back in service
  • Send Email notification

So I would like to do this to reduce the steps and management of duplicate steps.

We manage 100’s of applications and we need to keep our deployments as tidy and uniform where we can to avoid any downtime where possible.

Ideally I feel if you are able to choose the order of targets in a rolling deployment that would be very helpful.

I hope this makes sense (it’s very early here :wink: )

Thanks

Doug

Doug,

If I understand correctly, I believe we can achieve what you want.

Essentially, what I would suggest is making the manual-intervention steps part of the rolling-deployment (i.e. the first and last steps). The only catch is, you won’t be able to specify the order (hence your original question), so you’ll have to perform the manual steps on whichever machine Octopus informs you is currently being deployed.

So your deployment process would resemble the depiction in the attached rolling_manual_steps.png.

The key points are:

  • Create your package step first. You can add the manual-intervention steps as children, and then re-order them to execute before the package step. You can’t add the package step as a child of the manual-intervention step.

  • In the ‘Instructions’ field of the manual-intervention step, use the Octopus.Machine.Name variable to display the current machine. This will inform you which machine to perform the manual-task on. For an example, see the attached manual_step_machine_context.png.

What do you think? Could this work for you?

I would also encourage you to find a way to automate your manual steps, but I’m sure that’s occurred to you :wink:

Regards,
Michael