Day 24 Task: Complete Jenkins CI/CD Project
Task-01
- Fork this repository:
- Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.
1️⃣ Create an AWS EC2 instance
2️⃣ Install Jenkins on AWS EC2 instance
1. sudo apt update
2. sudo apt install openjdk-11-jre
3. java --version
4. curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
5. echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
6. sudo apt-get update
7. sudo apt-get install jenkins
8. systemctl status jenkins
3️⃣ Open port 8080 from AWS Console
4️⃣ Setup Jenkins
🚀 Click on Create a job.
🚀 Create Freestyle Project
🚀 Provide GitHub URL.
🚀 Click on Build Steps and select Execute Shell.
🚀 Click the Save button and the job will appear on the dashboard screen.
🚀 Click the build button and go to console output.
🚀 Check the code inside the EC2 instance
🚀 Install docker on EC2
1. sudo apt-get install docker.io -y
2. sudo usermod -aG docker jenkins
3. sudo reboot
🚀 Build Code through docker
🚀 Successfully build
🚀 Run Code through docker
Note:- Open port 8000 On the EC2 instance
🚀 Successfully Run
🚀 Open the particular IP on which it is hosted. It will be up and running.
🚀 Click on job->configure and select “GitHub hook trigger for GITScm polling”
🚀 Add a webhook. To add it, follow the section given below.
Open the GitHub repository.
Go to “settings” and then to “hooks”.
Click the “Add webhook” button. Enter “<Jenkins url>//github-webhook/” Payload URL. Click on Add webhook.
🚀 Make any changes in the GitHub repo and edit any header file. The job will run automatically and changes will be made.
🚀 Open the particular IP on which it is hosted. It will be up and running.
Task-02
- In the Execute shell run the application using Docker compose
🚀 Install Docker-Compose on the EC2 instance
🚀 Give docker commands in the executing shell(The project should be integrated with GitHub repo and Jenkins). Click on save.
🚀 Click on build now. The job will run successfully.
🚀 Open the particular IP on which it is hosted. It will be up and running.
Thank you!!
Subscribe to my newsletter
Read articles from Ritul Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ritul Gupta
Ritul Gupta
Im looking for an opportunity to start a career in Cloud Technologies where I can enhance my knowledge and skills. Having knowledge and hands-on on Azure Cloud, AWS & Open Source tools - Docker, Kubernetes, Jenkins, Source Version Control, CI/CD Pipelines, and Script.