Dynamic blue/green deployment

Hi,

We are in the process of setting up Octopus on our new infrastructure. We currently have a HAProxy load balancer in front of two IIS web servers. We are wanting to do blue/green deployments with one server being designated as green and the other blue.

We had something working where we could manually deploy to either blue or green, including steps to tell HAProxy to switch between which is live and which is staging. We followed the process in the documentation for blue/green deployments. However, we would like to take out the human choice of deploying to blue or green and have just one deployment that only goes to whichever server is currently staging (as that is the only one we should ever deploy to).

We have the steps in place to work out which is which by running scripts against HAProxy but what we are struggling with is how we add a step to deploy to the correct server only, using a variable.

We set up each one as an environment but can it be done as one environment that they are both in?

Any suggestions on how we could configure our set up to achieve this or should we not be doing it this way?

Thanks

Hi Barry,

Thanks for getting in touch,

I greatly appreciate your patience and detailed summary, this really helps out!

Based on the information provided in your query, it sounds like this could be achieved by implementing the following setup;

  1. Include a Script step (which you mentioned you have steps in place to work out which is which) to determine which server is currently in staging;

  2. Have this Script step produce an Output Variable based on the result; (i.e. #{BlueDeployment}, #{GreenDeployment})

  3. Have the subsequent steps in your deployment process only execute via a Run Condition where the output variable expression is true (this would require duplicates of each step that rely on different output variables (i.e #{BlueDeployment}, #{GreenDeployment}

  1. Each step would need to be scoped to an associated role that is specific to the targets within the Green or Blue environment; (In my example, however, both my targets reside in the same environment but conceptually the same as having unique environments for Blue/Green Targets)

I hope this helps!

Please let me know if you have any further questions about this or if I have missed anything :slight_smile:

Kind Regards,

Reece

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.