Even when everything is going well and you’ve got continuous deliveries running like clockwork, it’s still a leap of faith to update your production environment. Any problem immediately becomes a big deal when it’s in production and might affect everyone who is using the application. That’s the main reason for canary deployments — the practice of deploying to one or a few nodes first, and then sending a few customers to try out the new version before you make the leap to sending all customers to that new version. It’s like getting a taste of some new food before you commit to it entirely — always a good idea when you’re experimenting!
I’ve got a document here about Deploying applications with canary nodes for more detail, but at a basic level, all you have to do is tag your canary node or nodes with a resource tag like “canary,” and then set up your processes to deploy to that tag first.
You can put the canary tag on resources either in the resource tree or in the environment resource mapping. Just click the tag icon next to an agent resource and pick a tag:
Then, in the application process, you can use a For Each Tag loop to deploy first to the canary tags, run some automated tests, and then run over the other resources. I’ve listed a few ways of doing this in Deploying applications with canary nodes, but one way is to include the deployment steps as part of the For Each Tag loop with some automatic tests and rollback steps. The following process deploys my application, runs tests on it, and rolls back if anything goes wrong:
Those steps are all inside a For Each Tag loop, so when I run the process I pick the tags to run on and the order in which they run. So I just select the canary tag first, and then select whatever other tags I have on the other nodes:
That’s all there is to it, at a basic level. You can set up the tags and processes any way you want to deploy to a test system before you take the plunge. For example, if you’ve got database nodes and application nodes, you can set up one node of each to be the canary system.
For more details, see Deploying applications with canary nodes. I’ve also included canary nodes as part of a larger scenario in Setting Up Blue-Green Deployments in IBM UrbanCode Deploy 6.2.4.