Green/Blue deployment: how do I do IIS Reset in the *other* environment

Very informational article here: https://octopus.com/docs/patterns/blue-green-deployments

Let’s say I’m running octopus deploy process to green environment. After I’ve finish that and switch green to become the active one I’d like to do IIS reset on the other (blue) environment as part of the same process. How do I achieve that with Octopus Deploy?

Hi,

Thanks for getting in touch! Firstly for IIS resets, you can use the IIS - Reset community step template here.
https://library.octopusdeploy.com/step-templates/2db9af2b-1d9a-4089-9d84-98d9118b39ad/actiontemplate-iis-reset

This step would need to be scoped to a role. To ensure it runs the step on the correct machine for each environment, this is what I would suggest. You can actually register the same machine twice, giving them different names and roles, but all other details will be the same. For example, you could have:

Blue01 in Production - Blue environment with role web-server
Blue01 in Production - Green environment with role inactive-web-server
Green01 in Production - Blue environment with role inactive-web-server
Green01 in Production - Green environment with role web-server

You could then configure the IIS - Reset step from the community library, and scope it to the inactive-web-server role. :slight_smile:

I hope this helps and let me know if you have any further questions!

Kind regards,

Kenny

Kenny, just to clarify, are you suggesting re-labeling roles from active to inactive every time I do a deployment and swap the servers? That would be hugely inconvenient.

Hi,

Thanks for following up! I’m sorry I wasn’t as clear as I should have been in explaining that. No, you won’t need to re-label the roles for each deployment (that would indeed be very inconvenient). You can instead re-register the same machine with the same details, just with a different name and role. Each duplicate would be in the other environment. I’ve set up an example model and attached a screenshot, as that may be easier to visualize. :slight_smile:

In this example, my original machines are in the Production - Blue environment. IIS - Reset step is scoped to the inactive-web-server role, and will run on Green01 when I deploy to Production - Blue. However, when I deploy to Green, this step will run on Blue01-duplicate. Both Blue01 and Blue01-duplicate are the same targets, just with a different name and role.

Does that look like what you’re after? Let me know what you think and if you have any further questions.

Kind regards,

Kenny

Thank you for the picture! Let me see if I can figure that out :wink: