Skip to content
Sneha Tilak edited this page Feb 20, 2017 · 5 revisions

Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.

Continuous Deployment (CD) is an extension of continuous integration, aiming at minimizing lead time, the time elapsed between development writing one new line of code and this new code being used by live users, in production.

Application Containerization is an operating system level (OS-level) virtualization method for deploying and running distributed applications without launching an entire virtual machine (VM) for each app. Instead, multiple isolated systems are run on a single control host and access a single kernel.

Problem Statement:

We need to make the code easily deploy-able by having a build and make it IDE and developer friendly.

Possible Solutions:

CI Solutions

Feature Source
Travis-CI travis-ci.org
Jenkins jenkins.io

CD Solutions:

Feature Source
Amazon AWS aws.amazon.com

Containerization Solutions:

Feature Source
Docker docker.com

Solution Evaluations:

Continuous Integration

Travis-ci and Jenkins, while both are tools for continuous integration are very different. Travis is a hosted service (free for open source) while you have to host, install and configure Jenkins.

Travis does not have jobs as in Jenkins. The commands to run to test the code are taken from a file named .travis.yml which sits along your project code. This makes it easy to have different test code per branch since each branch can have its own version of the .travis.yml file.

Depending on where the code repository is hosted we can make the following choices:

  • in-house → Jenkins
  • Github.com → Travis-CI

###Travis CI vs Jenkins:

Setting up CI for a project:

Travis: Very easy to setup with a Github account.

  • Login to Github
  • Create web hook for Travis
  • Login to Travis CI with Github credentials and sync the Github repository and enable Push and Pull requests.

Jenkins:

  • Create an Environment (Master Jenkins)
  • Create web hooks
  • Configurations on each job (takes time compare to Travis)

Re-run the builds:

Travis: Every push made on the Github repository triggers a build.

Jenkins: Provide phrase text in PR/commit description like "reverify jenkins".

Controlling environment:

Travis: Travis provides hosted environment. It installs required softwares for every build is a time consuming process.

Jenkins: It's a onetime setup. It installs all the required softwares in node/slave machine and perform all the tests on pre-installed environment.

Build Logs:

Travis: Supports build logs to place in Amazon S3.

Jenkins: Easy to setup with build artifacts plugin.

Continuous Deployment

Amazon AWS: AWS provides a low-cost, scalable and highly reliable infrastructure platform in the cloud. AWS services include:

  • Simple Storage Service – This covers archiving of application programs and data and online backup. The service is low cost, high speed and scalable.
  • CloudDrive – This lets users utilize web connected devices to access and upload photos, music, documents and videos. They can also use their devices to stream music.
  • RedShift – The service is designed for analytic workloads connecting with business intelligence tools and standard SQL based clients. It is a data warehouse service that handles petabyte-scale data.
  • CloudSearch – is used for the integration of customized search capabilities and is a scalable search service.
  • Mechanical Turk – This lets developers incorporate human intelligence in remote procedure calls. It is an application program interface (API) that uses a human network to carry out tasks that computers are not suitable for.
  • Dynamo Database – is a NoSQL database which is fully managed and known for its scalability and low latencies.
  • ElastiCache – is protocol-compliant with Memcached, which alleviates database load by speeding up dynamic web applications. Memcached is an open source and high performing distributed memory object caching system. ElastiCache is a fully managed caching service.
  • Elastic Compute Cloud – can be used as an unlimited number of virtual machines and lets business subscribers run app programs.

Advantages of AWS:

  • Security – It is a durable and secure technology platform. To ensure the safety and integrity of your data, Amazon’s data centers and services have several layers of physical and operational security. AWS conducts regular audits to ensure its infrastructural security. It ensures the availability, integrity and confidentiality of your data and provides ‘end to end’ privacy and ‘end to end’ security.
  • Cost-effectiveness – AWS provides low and ‘pay as you go’ pricing. You consume only as much storage or computing power as required. You can terminate your relationship with AWS whenever you want to, scale down or scale up as required and have a fully self-service experience online.
  • Flexibility and Openness – You can select the services (one or more) you want to use and also select how to use them. You can use the programming languages, architectures, operating systems and databases you are familiar with. It is cost-effective and easy to migrate legacy apps to the cloud. You don’t have to rewrite apps and can utilize advanced capabilities of computing to move legacy apps to AWS cloud.
  • Elasticity and Agility – In the context of AWS, the ability to scale computing resources downwards or upwards without difficulty and with very little friction is known as elasticity. It helps to not provision resources upfront for projects with short lifetimes or variable consumption rates.

Application Containerization

Docker is an open source tool designed to make it easier to create, deploy, and run applications by using containers. Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.

Advantages of Docker:

  • Continuous Deployment and Testing – Docker containers are configured to maintain all configurations and dependencies internally. As a result, you can use the same container from development to production making sure there are no discrepancies or manual intervention.
  • Multi-cloud Platforms – Docker containers can be run inside an Amazon EC2 instance, Google Compute Engine instance, Rackspace server or VirtualBox, provided that the host OS supports Docker. A container running on an Amazon EC2 instance can easily be ported between environments, say to VirtualBox, achieving similar consistency and functionality. This grants you a level of abstraction from your infrastructure layer.
  • Environment Standardization and Version Control – Docker containers work just like GIT repositories, allowing you to commit changes to your Docker images and version control them. A Docker image is as fast as running a machine process.
  • Isolation – Docker makes sure each container has its own resources that are isolated from other containers. You can have various containers for separate applications running completely different stacks.
  • Security – No Docker container can look into processes running inside another container. Since Docker containers are isolated and resources are limited, even if one of your applications is hacked, it won’t affect applications that are running on other Docker containers.

Conclusion:

We are going ahead with the following:

  • Travis CI provides better support for Open Source projects. Our code base in present in a Github Repository which deploys build on Amazon S3.
  • Amazon AWS cloud is a secure service that can help you to reduce costs of infrastructure such as servers, along with savings on the number of staff required to build and maintain the infrastructure.
  • Docker provides a better support for a DevOps-centric workflow.

In the future milestones, depending on the environment, there is scope to experiment with other options like Jenkins, Opensource, Kubernetes, etc.

Steps:

  • We have created the Laravel Portal as a develop branch under the Spring 2017 - Laravel Portal
  • The Continuous Integration and Continuous Deployment tools used are Travis CI and Amazon AWS respectively, to deploy the changes made to the system.
  • The develop branch has a .travis.yml provides build instructions with the S3 and CodeDeploy details and appspec.yml file provides the location of the before-install and install scripts.
  • before-install script contains installation steps of certain services that need to be installed on the instance in order to function effectively and install script contains the instructions to run the portal and docker containers.
  • In order to trigger the Travis build, make a change to the Deploy.txt file under the develop branch.
  • Once the build is successful, it will start CodeDeploy on Amazon AWS.
  • The artifacts (zip file) containing the files and folders will be uploaded to the S3 bucket and deployed on to the EC2 instance.
  • The three Laravel Portals will now run as containers on each of the spot instances from different regions.

Note - The installation scripts are self explanatory with comments.

Associated Github issues