Skip to content

Blue/Green deployment with CNO Deploy

This deployment model releases two versions of the application simultaneously in production environments:
- The first, Blue, is unchanged and is automatically deployed on the market.
- The second, Green, is available for review by internal teams but remains offline.

It is up to you to choose the right moment to release the Green (new) version with the freedom to roll back to the Blue (old) Version.

For example, you can deploy a new version on your production environment without exposing it to the general public.

This means that the staging version would be production-ready, and you can choose the ideal moment to switch the flow to the new version quickly or cancel it if you don't trust the version.

Using the Blue-Green Strategy from CNOCTL

Run this command to use the blue/green strategy:

cnoctl deploy workload <workloadName> --strategy blue/green --project project_name --env <environmentName>

There will be two versions of the application running.
One contains the live version, and the other the staging version.

cnoctl get workload --project <ProjectName> --environment <EnvironmentName>

The result should look like this:

NAME STRATEGY REPLICAS IMAGE AUTO-DEPLOY LIVE STAGING
workload Name blue/green replicas Number username/workloadName true/false 1.0.0 1.0.0

Now we have the same version on the live and the staging version

Deploying New Version with CNOCTL

We can deploy version 3.0.0 with this command:

cnoctl deploy workload <workloadName> --version 3.0.0

Now the staging deployment will contain version 3.0.0 and the live version with 2.0.0

cnoctl get workload -e <environmentName> -p <projectName>
NAME STRATEGY REPLICAS IMAGE AUTO-DEPLOY LIVE STAGING
workload Name blue/green replicas Number username/workloadName true/false 2.0.0 3.0.0

We can check if CNO redirected the flow to the live version with this command:

curl -w "\n" http://localhost:8080
Result Example:
version 2.0.0

Going Live With CNOCTL

Run the following command to make the staging version live:

cnoctl deploy workload <workloadName> --go-to-live -e <environmentName> -p <projectName>

From now, CNO will switch live and intermediate deployment. The live deployment contains version 3.0.0 and staging 2.0.0.

cnoctl get workload -e <environmentName> -p <projectName>
NAME STRATEGY REPLICAS IMAGE AUTO-DEPLOY LIVE STAGING
workload Name blue/green replicas Number username/workloadName true/false 3.0.0 2.0.0

CNO redirected the flow to version 3.0.0.

curl -w "\n" http://localhost:8080
Result Example:
version 3.0.0

Deploying the Blue/Green Strategy from CNO UI

We can also deploy the and manage the Blue/Green Deployment through the CNO UI.

Go to Deploy > Continuous Deploy

You’ll see all workloads. Tap the Edit button for your workload.

Click “Strategy” and choose Blue/Green from the Dropdown.

Deploying the B version

You can also choose the B version of your application by scrolling down and choosing the version you want from the dropdown in “Staging”.

Going Live with CNO UI

When you're completely satisfied with the new version of your application and you wish to push it live. Select your image deployment "Go To Live" and you'll be taken to the Go-to-live page of your workload. Simply click the button in front of your staging application link.

You'll be taken to a prompt page, confirm and your staging application will be pushed live while your former live application will be pushed to the staging environment.


Last update: 2022-12-26