Admin Guide

A system administrator needs to be able to manage the Continuous Integration/ContinuousDeployment (CI/CD) pipeline, and upgrade the application when necessary. Some of the tasks that a system administrator might want to do are listed below.

Back to all guides.

Prerequisites

  1. Login details for the development and production IBM cloud environments.
  2. Installing the IBM cloud command line interface (CLI): Several of the steps below require using the IBM cloud CLI. Details for installing this can be found here.
  3. Installing Kubectl: This is required to run commands against Kubernetes Clusters. It is required for several of the steps below, and details for how to install it can be found here.

Trigger a deployment to production

A brief overview of the Continuous Integration portion of our pipeline is as follows:

There are two main branches, master and develop. We are following a gitflow workflow, so feature branches are cut from develop, worked on locally and then merged back into develop. Changes to any branch will trigger a deployment of that branch to develop, however only changes to the master branch will trigger a deployment to the production environment.

As such, whenever one wants to start a deployment to production the steps are as follows:

Check the status of the Develop/Production Cloud Registries

The IBM Cloud Registry (CR) service is where we are storing containers of our application. When using the free tier of this service, there are restrictions on storage (how many containers we can store) and pull traffic (how many containers we can pull from the CR). Every time a new deployment is made, the relevant container is pulled from the CR, so the pull traffic restriction is essentially a limit on deployments per month.

Modify/Update the CR image retention policy

There is a storage limit for the free tier of the IBM CR service. As of writing this is 500MB. Depending on the size of the containers being stored here, this will limit the amount of containers we can store. Currently our docker images are ~10MB, although this is most likely to increase slightly in the future. Since each new build results in a new image being stored, eventually we will reach our storage limit.

IBM cloud provides a solution for this with their image retention policies. Details of this can be found here.

To list the current retention policies:

To set and run a retention policy:

Check the status of the Develop/Production Kubernetes Clusters

This can be done either through the IBM cloud user interface, or by using the IBM cloud CLI.

To check using the IBM cloud UI:

To check using the IBM CLI:

Check the color of the current deployment

We are currently using a Blue/Green deployment strategy, so it may be required at some point to see whether the current deployment is a blue or a green one. This can be done by checking the Travis CI logs of the last successful build, or through the IBM cloud CLI.

To check using the IBM CLI:

To check the Travis CI logs:

Roll-back to previous deployment

Since we are using a blue-green deployment strategy, this allows for quick and easy switching between two production deployment environments. This might be required if, for example, something goes wrong with a production deployment so it’s required to roll back to the previous production deployment.

This will switch the deployment that the service which exposes our application is pointing at from blue to green, or visa versa. These commands can also be run for the develop environment, by logging into it and replacing prod_cluster with develop_cluster.

Check the endpoints for current Develop/Production deployments

The endpoints of our deployments are in the format <cluster IP>:<node port>, where cluster IP is the public IP address of the cluster, and node port is the port on which the application is exposed by our kubernetes service. Since the cluster IP is static for that cluster and the node port is set by the service.yml file, these endpoints should remain static. It may however be required to discover the endpoint of the deployments at some point, for example if the cluster needs to be re-built at some point.

Add another stage to the pipeline

It may be necessary, at some point, to add another stage to the pipeline. An example would be if one wanted to add end-to-end testing on production deployments, automatically rolling back to previous production if testing failed. The pipeline stages are defined in the .travis.yml file, located at the root of the project. Helpful Travis CI documentation on Build Stages can be found here.

To add another stage: