Load balanced deployment with octopus deploy (Netscaler)

Hi,

I’m trying to setup Octopus deploy through our Netscaler load balancer, and I’m having some issues, that the rolling deployment scenario might be to limited to achieve. This is a question/discussion on how to best achieve this.

In netscaler (the load balancer) - I’m disabling just one servicegroup (i.e. one specific port for a service) meaning that the rest of the server is operational when I’m deploying the update.

We have a different number of servers that are serving requests (ranging from 2 - 12 servers)
IE the QA environment often have 2-3 load balanced servers.
Producation environment ranges from 2-12 servers serving load balanced requests.

With a rolling deployment you have to specify how many servers you take out at a time.

Scenario (non-breaking changes)
a rolling deployment, taking out 1 server, updating it, putting it back in, taking the next one out, will most likely work fine.

Scenario (breaking changes i.e. meaning I can’t have old and new code running at the same time, it’s either/or)
1)
In this scenario, I need to find out how many servers are running the code (haven’t found this anywhere) i.e listing out which servers have a role running on it. Is this possible, through powershell? IE QA has 2, PROD has 12 servers.
2)
if it’s 2 servers, a rolling deployment of 1 needs to be set, while if it’s 12, then a rolling deployment of 6 needs to be set.
is it possible to set this value run-time in a rolling deployment?
3)
After I have determined how many servers i need to take out of the load balancing, I will have my powershell ask which servers are in the servicegroup in Netscaler, and disable half of these, then for the next step of the deployment take out, update the next batch of servers.

Any advice on how to best achieve this through Octopus?

If i’m not able to access which roles are running on the servers, determining which servers are running the, I will end up with a hardcoded octopus deploy, which will have to be manually updated each time we remove or add a server
role.

Ideally this would be nice and dynamic, as I’m having approximately 30 packages/deployments that are load balanced,
and the effort to maintain these would take a lot of time.
Looking forward to hear if anyone have any ideas on how to do this, or how you solved your load balanced deployments.

Best regards,
Bjørn

Hi Bjørn,

Thanks for getting in touch. It looks like you have this mostly figured out! Your scenario for handling breaking changes should work fine, I have some notes for each of your questions below.

1) 1)	In this scenario, I need to find out how many servers are running the code (haven't found this anywhere) i.e listing out which servers have a role running on it. Is this possible, through powershell? IE QA has 2, PROD has 12 servers.

There is a way that you can do this. You are able to query the API and use OctoPosh to see which servers are currently running the code. OctoPosh is our PowerShell module that contains Cmdlets created for Octopus. https://github.com/Dalmirog/OctoPosh

2)	if it's 2 servers, a rolling deployment of 1 needs to be set, while if it's 12, then a rolling deployment of 6 needs to be set. is it possible to set this value run-time in a rolling deployment?

Yep! You are able to bind a variable to the max window size field. However, it was not working correctly. We fixed this behaviour in Octopus version 3.8.6. Below I have linked to the GitHub issue for the bug.

3)	After I have determined how many servers i need to take out of the load balancing, I will have my powershell ask which servers are in the servicegroup in Netscaler, and disable half of these, then for the next step of the deployment take out, update the next batch of servers.

This is correct! It looks like you are most of the way towards having your rolling deployment work just how you want it to work.

If I can better explain anything here or provide you with any further information, please done hesitate to ask.

Best regards,
Daniel