Using CodeShip with CodeDeploy

Reading Time: 5 minutes

What is CodeShip ?

CodeShip is a hosted continuous delivery service that focuses on speed, simplicity and reliability. It is a fast and secure hosted CI service that scales as per user’s needs. CodeShip was founded in 2011, and pretty soon it became one amongst the Saas Continuous Integration and Continuous Delivery leader in the market.

CodeShip is now backed by a larger company with an extensive customer support, CloudBees. CloudBees Inc, the hub of enterprise Jenkins and DevOps, acquired CodeShip on February 6, 2018.

CodeShip comes in two flavours:

  • CloudBees CodeShip Basic
  • CloudBees CodeShip Pro

CodeShip can provide high speed – every time we run a build on CodeShip, it store the dependency packages as cache for future runs. Thus, reducing the amount of time required to run each future build.

In terms of reliability, codeship is very secure. It maintains security on the VMs. It is a fast and secure CI service that basically scales with our needs. With the increased number and size of builds, it handles the scalability factor on it’s own. It is responsible for increasing the resource limits like CPU, memory, etc, whenever there is an increase in the load: the number of commits and thus, the number of builds increases.

Differences between different flavours of CodeShip:

CodeShip BasicCodeShip Pro
Works out of the boxHas Native docker support
Pre-installed CI dependencies.Fully Customizable CI environment.
One-click App integrations.Local build runner for test consistency.

The codeship pro has native docker support. This means that every time there will be an upgraded stable version of Docker available, CodeShip Pro will automatically use the latest stable version for running the builds. But, CodeShip Basic does not support containerization.

The CodeShip Basic version offers a simple and decent UI to configure the CI dependencies. On the other hand, with CodeShip Pro, we get the complete docker support to ensure the resources which will be required by the services being deployed, can be customized as per needs.

CodeShip Pro works on a single-tenant AWS instance, providing us the full control of the instance resources and the limits to them. But, this is not the case with CodeShip Basic.

Why CodeShip?

  1. Security: For every project that is added to CodeShip, a unique SSH key is created. This key, in itself, is strongly encrypted and is only decrypted shortly before being used in the build virtual machine.
  2. All communication with the build virtual machines can only be done via SSH.
  3. Next, it supports a variety of programming languages (Ruby on Rails, Node.js, PHP, Java, Go, Dart, etc.) and deployment platforms (Amazon Web Services, Heroku, Google App Engine, etc.)
  4. Parallel test pipelines feature to speed up the builds.

Parallel Pipelines

codeship-parallel-pipelines

Features of CodeShip

  • Faster builds, always reliable
  • Simple and easy to use.
  • Builds run on pre-configured machines.
  • Scalable
  • Secure
setup-codeship
Working with CodeShip

Introduction to CodeDeploy

CodeDeploy is a deployment service that automates application deployments to:

Amazon EC2 instances, on-premises instances, serverless Lambda functions, or Amazon ECS services.

workflow

Features of CodeDeploy

AWS CodeDeploy eases the process of rapidly releasing new features. It helps in avoiding downtime during application deployment, and handles the complexity of updating applications.

  1. Automated Deployments
  2. Centralised Control
  3. Minimise downtime
  4. Easy to adopt
  5. Helps rapidly release new features.

Working:

codedeploy-architecture

CodeDeploy can deploy application content that runs on a server, and is stored in Amazon S3 buckets, GitHub repositories, or Bitbucket repositories. CodeDeploy can also deploy a server-less Lambda function.

Deployment Workflow (for an amazon EC2 instance),

deployment-workflow

Importance of “appspec.yml”

CodeDeploy uses an appspec.yml file to define application specification, in order to manage a deployment.

The deployment logic data is stored in a file called appspec.yml. The compute platform used, indicates the structure of the appspec.yml file.
The structure of this file varies in terms of the environment used to deploy the application in. Here, we will discuss the structure of this file w.r.t. Amazon EC2 instances. For example,

version: 0.0
os: operating-system-name
files:
  source-destination-files-mappings
permissions:
  permissions-specifications
hooks:
  deployment-lifecycle-event-mappings

Here,
version: It defines the version of this appspec file. It is a mandatory field. One cannot edit it. Currently, the only allowed value is 0.0.
os: This section specifies the operating system value of the instance to which we want to deploy. This is mandatory too. Currently, the only values supported are: linux and windows.
files: It specifies the file names that will be copied to the AWS instance.
permissions: This section specifies how special permissions, if any, should be applied. They are applied to the files in the files section when they are copied over to the instance. It only applies to the linux instances.
hooks: This section specifies commands / scripts to run at specific events during the deployment.

How to set up AWS CodeDeploy ?

In order to get started with AWS CodeDeploy, refer the below diagram containing all the steps.

setup-codedeploy-aws
What are Deployment Configurations ?
  • It indicates, how many instances, the application revisions should be simultaneously deployed, and
  • Also, it describes the success and failure conditions for the deployment.
codeship-codedeploy-Deployment-Configurations
How do rolling updates work ?
  • We can configure a deployment group to automatically roll back deployments when certain conditions are met. These conditions can include, when a deployment fails or an alarm monitoring threshold is met, etc.
  • Can also override the rollback settings, specified for a deployment group in an individual deployment.
  • Can also choose to roll back a failed deployment by manually redeploying a previously deployed revision.
codedeploy-rolling-update

Thanks for keeping up.

References

knoldus-blog-footer-image