Join our telegram channel and group :)
Telegram Group: https://t.me/randomskoolQnATelegram 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."
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?
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.list3. Update the Package Manager
sudo apt-get update4. Installing Jenkins
sudo apt-get install jenkins5. Start the Jenkins service
sudo systemctl start jenkins
sudo systemctl status jenkins6. 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/initialAdminPasswordInstall 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:
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:
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:
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:
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-chromedriver
sudo apt-get install default-jdk
Screenshot Attached for Reference:
Complete Pipeline Screenshot-
Hope you guys understand the end to end DevOps pipeline using AWS EC2.
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/randomskoolQnATelegram Channel: https://t.me/randomskool
great tips for aws we offer the best aws certification training in california aws certification training in california
ReplyDeleteThe information which you have provided in this blog is really useful to everyone. Thanks for sharing.
ReplyDeleteDevOps Training institute in Ameerpet
DevOps Training in Hyderabad
DevOps Project Training
DevOps Training in Ameerpet
DevOps Training institute in Hyderabad
DevOps Course in Hyderabad