Skip to content

Continuous Deployment Tutorial with Cloudoor

In this tutorial, you will see how to use Cloudoor to manage the deployment of your applications. We will show you how to scale up/down applications, manually deploy new versions (continuous delivery), detect and auto-deploy new versions pushed on your docker registry (continuous deployment), use advanced deployment strategies like Blue/Green, Canary, or A/B Testing.

Prerequisites

  • A Cloudoor Cluster: Head over to the QuickStart section to see how to deploy one

  • door installed on your computer

Create a Project and an Environment

1 Create a project named: lab

door create project lab --cpu 2,1 --memory 4Gi,2Gi --storage 0Gi 

This command allows you to create a project named lab with 2 cores CPU-limit, 1 core CPU-request, 4Gi memory-limit, 2Gi memory-request and, 0Gi storage.

Warning

You must wait for quota request validation if you are not super_admin or owner+.

2 Create environment named: cloudoor-cd-lab

door create env cloudoor-cd-lab --cpu 2,1 --memory 4Gi,2Gi --storage 0Gi --project lab --cluster default 

This command allows you to create an environment named cloudoor-cd-lab on the lab project with two cores CPU-limit, 1 core CPU-request, 4Gi memory-limit, 2Gi memory-request, and 0Gi storage, and deploy the environment on the default cluster.

3 Create and push an image to your docker registry

Clone the version-printer repo

git clone https://github.com/beopencloud/version-printer.git
cd version-printer

Build and push version 1.0.0 to your docker registry

git checkout 1.0.0 
docker build . -t <your username>/version-printer:v1.0.0
docker push <your username>/version-printer:v1.0.0 

Build and push version 2.0.0 to your docker registry

git checkout 2.0.0 
docker build . -t <your username>/version-printer:v2.0.0 
docker push <your username>/version-printer:v2.0.0 

Deploy your Environment

1 Connect to the cloudoor-cd-lab environment

door use env -e cloudoor-cd-lab --project lab 

This command allows you to get a kubeconfig enabling you to access the cloudoor-cd-lab environment. And then, you can apply kubectl commands.

2 Deploy the version-printer application on your environment

kubectl create deployment version-printer --image <your username>/version-printer:v1.0.0 
kubectl create service clusterip version-printer --tcp 8080:8080 

3 Port-forward and check if the application responds correctly

Open a new terminal and run the following command

kubectl port-forward service/version-printer 8080:8080 

On another terminal, run the following command to test if the application responds correctly

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

Overview of the CD Operator

A CD operator on the Cloudoor data-plane monitors Kubernetes objects such as deployments, StatefulSets, DaemonSets, Services, and Ingress present in environments. It's, therefore, possible to retrieve the list of all workloads (applications) currently in an environment. In addition, the operator also monitors the docker registry to detect new versions of applications.

You can use cd functionality from cloudoor U.I. or door. For example, we can get the list of workloads deployed in the namespace cloudoor-cd-lab with the following command.

door get workload --project lab --env cloudoor-cd-lab 
NAME STRATEGY REPLICAS IMAGE AUTO-DEPLOY LIVE STAGING
version-printer default 1/1 /version-printer false v1.0.0 -

Scaling

You can scale up/down an application directly from Cloudoor without accessing the cluster api-server where you deployed the application by typing :

door deploy workload version-printer --replicas 2  --project lab --env cloudoor-cd-lab 

You can increase the number of replicas of the version-printer application to two with the following command:

door get workload --project lab --env cloudoor-cd-lab 
NAME STRATEGY REPLICAS IMAGE LIVE STAGING
workloadName strategyChosen replicasNumber username/workloadName liveVersion -

For example:

NAME STRATEGY REPLICAS IMAGE LIVE STAGING
version-printer default 2/2 your username/version-printer 1.0.0

And you can scale down to 1 by typing this command:

door deploy workload version-printer --replicas 1  --project lab --env cloudoor-cd-lab