












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A comprehensive guide on setting up a ci/cd pipeline using jenkins, docker, and aws. It covers the essential steps involved in creating an ec2 instance, installing jenkins and maven, and configuring the pipeline to automate code integration, testing, and deployment. Particularly useful for students and professionals interested in devops practices and cloud-based infrastructure.
Typology: Assignments
1 / 20
This page cannot be seen from the preview
Don't miss anything!
Introduction The CI/CD (Continuous Integration Continuous Delivery/Deployment) Cycle – Code Build Test Deploy is what we are going to do in the project today. We are going to build a CI/CD Pipeline as a project today. The App will be built upon Node JS today. Primary objective of the task that we are going to do that we want to accomplish the following things in the project: - Prerequisites for this project- Idea on Jenkins, Docker, AWS Scenario – The Developer will give the code to GitHub. The Devops engineer needs to take the code from the GitHub. The Devops engineer responsibility is to ensure that the code runs in the AWS Environment. The code should be continuously integrated – This code should be able to run on any cloud environment (CI will make sure this – the code should be integrated (running) in any environment). The developer may have written the code in Windows/Linux/MacOS, etc but the Devops engineer should ensure that the code runs on any environment. Docker is the tool that will be used a virtualised environment. – Docker helps regarding creating Virtualized container – Using docker we will confirm prove that this code in running in multiple environments – Windows, Linux, MacOS. The First tool is Docker The code will be brought from GitHub This code will be run on AWS EC2 Instance. Our goal is to make a pipeline to ensure that this code runs properly integrated manner. This pipeline should make sure that whatever developer is keeping the new code in GitHub, the code should be brought from the github, docker needs to build the code using container mechanism, and then this pipline should deliver the code on the AWS EC2 Instance continuously. The tool to build this pipeline will be Jenkins.
Now that we have selected the server requirements, we have to connect to this server instance. So, create a new key pair.
a. Update your system - sudo apt update b. Install java - sudo apt install openjdk-11-jre c. Validate Installation - java -version d. It should look something like this. e. openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2) OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian- 2, mixed mode, sharing)
c. Next click on “Add rule” button and Type as “Custom TCP”, Port Range as “8080” and the Source Type as “Anywhere-IPv4” (If we have a static public ip of our own at our home network, then we can give that for more security). Then click on the “Save rules” button. d. Now open the Public IP of the Instance in the browser and you will see Jenkins page as below e. Now copy the password from the location of the sudo cat /var/lib/Jenkins/secrets/initialAdminPassword and paste it
j. Copy and save the URL somewhere and then click on “Save and Finish” k. Then click on “Start using Jenkins” button.
Git is already installed with the suggested packages at the time of Jenkins installation itself so let us now install Maven. Get the binary with the command line, curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5- bin.tar.gz Extract it and do ls you can see the apache-maven-3.9.5 folder: tar xzf apache-maven-3.9.5-bin.tar.gz Set environment variables. Update PATH to include Maven bin: Then check mvn –version Now we see that the Apache Maven has been successfully installed.
First before making the changes Stop Jenkins sudo systemctl stop jenkins sudo systemctl status jenkins Next go to the file /etc/default/Jenkins using sudo vi /etc/default/jenkins Then scroll down till you see HTTP_PORT=8080 now change it to 9090 and do :wq! And save it. Start jenkins
a. sudo systemctl enable jenkins b. sudo systemctl start jenkins c. sudo systemctl status Jenkins d. sudo /etc/init.d/jenkins start Now change the port in the Security Group Inbound Rules to 9090 and click on “Save Rules”