Assignment 1 and 2
Team Members:
- Thanmai M. Bindi
- Ameya Advankar
- Mayank Jaglan
- Sneha Tilak
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.
Theme 1 concentrates on implementing Load Balancing among multiple Laravel Portals across Amazon spot instances. We have used HAProxy to provide a high availability load balancer and proxy server that spreads requests across multiple servers. Memcached is used as a distributed memory caching system to manage sessions and secure the system. The version control mechanism used is Git and we have made the portal easily deployable by implementing Continuous Integration and Continuous deployment.
Mechanism:
Note: Image from Source
Problem Statement:
We need to make the code easily deploy-able by having a build and make it IDE and developer friendly.
Possible Solutions:
I delved into some possible solutions for the problem statement and concluded the following -
Continuous Integration -
Continuous Deployment -
Solution Evaluation:
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.
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:
Written on
February
27th,
2017
by Sneha Tilak