In Octopus Deploy, how can I deploy to a subset of servers, test the deployment, then deploy to the rest of the servers?

I have 10 web servers in my web farm, and I want to control the order they are deployed to. For example, I want to deploy Web01 -> Web02 -> Web03 -> Web04, and so on. My plan is to deploy to Web01 and Web02, run some verifications and make sure everything is working, then deploy to the remaining servers.

A common scenario we see is our users would like to deploy to a certain percentage of servers, then run some sort of automated or manual tests, and if those tests pass then deploy to the rest of the servers. This is known as a canary deployment. That term originates with miners, wherein they would bring a canary into the mine. If the canary died it was time to go.

How canary deployments are accomplished again depends on your requirements. I’ll present two options for you:

Option #1: Unique Canary Environment

In this option, there are four environments, Dev -> Test -> Production - Canary -> Production. The canary environment has a couple of the production machines, while production has the rest.

In this screenshot, there are 8 total production machines. 2 are in the canary environment, while 6 are in the regular production environment.

The deployment would end up looking like:

You can see this example for yourself here:

The advantages to this is it is simple, with only one additional environment.

Option #2: One production environment

In this option, there are only three environments, Dev -> Test -> Production. Deployments to production are first done to a set of canary servers, then to the rest of the servers. In simplifying the number of environments, the deployment process got much more complex.

As you can see in this screenshot, there are additional steps which only run for production, and have a unique role associated with them. The risk is higher steps 2 and 6.2 drift from one another.

I’d take a hard look at option #1 before jumping into option #2.

You can view this process here: