Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🚀 CI/CD Pipeline for Static Website using Jenkins on AWS

This project demonstrates how to build and deploy a static website (HTML, CSS, JS) to an Apache server on AWS EC2, using Jenkins as the CI/CD tool.


📌 Project Overview

  • ✅ Pulls source code from GitHub
  • ✅ Jenkins automates deployment
  • ✅ Apache serves the deployed website
  • ✅ End-to-end flow: GitHub → Jenkins → App Server → Live Website

🧰 Tech Stack

Tool/Service Role
Jenkins CI/CD pipeline manager
GitHub Source code repository
Apache2 Web server on App EC2
AWS EC2 Hosts Jenkins and App server
Bash/SCP For deployment script
SSH Keys Secure communication between Jenkins & App server

🛠️ Setup Steps

1️⃣ Create Two EC2 Instances

  • One for Jenkins
  • One for App server (Apache)

Open these ports in both:

  • 22 – SSH
  • 8080 – Jenkins UI (Jenkins server only)
  • 80 – HTTP (App server only)

2️⃣ Install Jenkins (on Jenkins server)

sudo apt update
sudo apt install openjdk-17-jdk -y
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /etc/apt/trusted.gpg.d/jenkins.asc > /dev/null
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins -y
sudo systemctl start jenkins

🔗 Access Jenkins:

http://<jenkins-public-ip>:8080

Set up admin password and install suggested plugins.

3️⃣ Install Apache (on App server)

sudo apt update
sudo apt install apache2 -y
sudo systemctl start apache2

4️⃣ Set Up SSH Between Jenkins and App Server

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub ubuntu@<app-server-ip>

This allows password-less deployment using scp.

5️⃣ Create deploy.sh Script (on Jenkins server)

On Jenkins server (as jenkins user):

#!/bin/bash

rm -rf /tmp/static-site
git clone https://github.com/itsiiie/test.git /tmp/static-site

scp -r /tmp/static-site/* ubuntu@<app-server-ip>:/var/www/html

Make it executable:

chmod +x deploy.sh

6️⃣ Configure Jenkins Job (Freestyle)

Type: Freestyle Project

GitHub URL: Your static site repo

Build Step: bash /path/to/deploy.sh

Trigger the build manually, or add GitHub webhook for automation

7️⃣ Fix Apache Permission Issue

On App server:

sudo chmod -R 777 /var/www/html

✔️ (This is temporary — use proper permission management for production)

8️⃣ Test Your Deployment

Run:

ls /var/www/html

Open In Browser:

http://<app-server-ip>

🎉 You should see your live website!

👨‍💻 Author Shashank Singh

DevOps Enthusiast | AWS | Jenkins | Ansible | Python

GitHub: https://github.com/itsiiie

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages