DevOps with AWS

DevOps with AWS
DevOps with AWS


Join our telegram channel and group :)

Telegram Group: https://t.me/randomskoolQnA
Telegram Channel: https://t.me/randomskool


Today we will learn how to deploy a simple web application in AWS using DevOps Pipeline.

What is DevOps?

"DevOps is an amalgamation of software development and operational activity."

"DevOps is a set of practices that combines software development and IT operations. It aims to shorten the systems development life cycle and provide continuous delivery with high software quality. DevOps is complementary with Agile software development; several DevOps aspects came from Agile methodology." ~ Wikipedia

The myth regarding DevOps ~

"DevOps is all about tools" BIG NO !!!

DevOps is not all about tools its practice that breaks the wall between Software Development and Operations team. But to implement DevOps process we requires set of tools.

DevOps Life Cycle 

1. Continuous Integration ( maintaining the continuous integration of all the steps involves in the DevOps life-cycle. For this, there are multiple tools available in the market that manages other tools such as for testing, development, monitoring, and many more).   
2. Continuous Deployment ( deploy the code changes continuously in different environments such as prod, test, and many more. )
3. Continuous Monitoring ( Monitoring the current changes in the environment continuously )
4. Continuous Development ( Develop the code as per the customer's requirement continuously and maintain the versions of code. ) 
5. Continuous Testing ( Crucial activity of any development process is testing and to continuous test, the code is an important part of the DevOps process.

Let's deep dive into the implementation of DevOps Life-Cycle.

Pre-requisites: 

1. AWS Account ( Free trial is sufficient )
2. Putty and Putty-KeyGen ( For Windows Users )

Let's create the AWS EC2 before installation to make things easier. 


2. Once server created to connect to ssh to proceed further with the installation process.


With the help of AWS EC2, we will deploy the complete DevOps pipeline, and deployment happens in the number of DevOps stages. 

Gradually we will learn the complete DevOps lifecycle as we begin further installation and setup process of Simple Web Application.

Stage 1 ( Continuous Integration ) 

In stage1, the continuous integration process is fulfilled with the help of the Jenkins tool.

What is Jenkins? 

Jenkins is a free and open-source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. It is a server-based system that runs in servlet containers such as Apache Tomcat.  Wikipedia


We are using Jenkins in this demo there are multiple other tools also available for continuous integration in the market.

Let's start with first setting up the Jenkins Master Server

1. Java is required for Jenkins 
sudo apt update
sudo apt-get install default-jdk
2. Setting up the key and configuration file
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
3. Update the Package Manager
sudo apt-get update 
4. Installing Jenkins
sudo apt-get install jenkins 
5. Start the Jenkins service
sudo systemctl start jenkins
sudo systemctl status jenkins
6. Configuring the Jenkins and Creation of the admin user
Copy the Master Server Public IP from AWS Console and Paste in new tab.
           http://<Server Public IP>:8080
           
          Copy the Jenkins Path for administrator password shown in the first screen and 
          paste in the terminal in the below way and copy the password and 
          paste it into the Jenkins screen.
 sudo cat /var/lib/jenkins/secrets/initialAdminPassword
          Install the Suggested Plugins and Create a new user ( such as Admin User ) 

          Jenkins setup is completed !!!

7. Setup the Jenkins Slave Server
Go to Manage Jenkins >>  Configure Global Security  >> Agents ( Select Random )
Go to Manage Jenkins >> Manage Node Cloud >> Click on New Node >> Enter Node Name and Select on Permanent and Enter Remote Root Directory ( jenkins/workspace ) and Click on Save. 
         Download the file ( agent and slave-agent file ) and 
         move it to the slave server using any file transfer tool.
     
         Run the Command in Background mentioned in the Jenkins Console and 
         Check the Connectivity in Jenkins Console for Slave Server 




Screenshot Attached for Reference:

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node

Setup Master and Slave Jenkins Node


Stage 2 ( Continuous Deployment )

In this stage, we are using one of the famous tools called docker a containerized tool.

We need to install docker on Slave Server ( Note )

1. Adding Key and Repository 

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

2. Package Manager Update

    sudo apt-get update

3. Installing and Verifying Docker 

   apt-cache policy docker-ce
   sudo apt-get install -y docker-ce
   sudo systemctl status docker

Screenshot Attached for Reference: 

Docker installation

Docker installation

Docker installation

Docker installation

Docker installation


Stage 3 ( Continuous Monitoring )

In this stage, we are using CAdvisor for container monitoring.


sudo docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:rw \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --publish=9980:8080 \
  --detach=true \
  --name=cadvisor \
  google/cadvisor:latest

Screenshot Attached for Reference: 

cAdvisor Monitoring

cAdvisor Monitoring


Stage 4 ( Continuous Development )

In this stage, we are GitHub for continuous development and version control.

Create a repository in GitHub:

We will need to Add Webhooks to automatically trigger the Jenkins pipeline if changes occur in code.

Screenshot Attached for Reference: 

Github Webhook

Github Webhook

Github Webhook


Stage 5 ( Continuous Testing )

In this stage, we are using Selenium for testing - 

Installation of Selenium ( Requirement - Java needs to be installed on Slave Server)

sudo apt-get install chromium-browser
sudo apt-get install chromium-chromedriver
sudo apt-get install default-jdk

Screenshot Attached for Reference: 

Selenium Installation

Selenium Installation

Selenium Installation


Complete Pipeline Screenshot-

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

Complete DevOps Pipeline AWS EC2

 

Hope you guys understand the end to end DevOps pipeline using AWS EC2.

For Queries and Contact there are multiple ways:

1. From telegram search @randomskoolQnA and @randomskool 
2. From Contact Us Page
3. From Comment 

For Daily Updates Please subscribe to the feed. 

For Job-related Updates Please fill the subscriber feedback form.


Join our telegram channel and group :)

Telegram Group: https://t.me/randomskoolQnA
Telegram Channel: https://t.me/randomskool


Till then....happy coding!!


2 Responses to "DevOps with AWS"

Hey Random,

Please let me know if you have any query :)

Adsense

Adsense

Adsense

Adsense