An open API service indexing awesome lists of open source software.

https://github.com/adityakonda6/python-app-pipeline

This repository contains the source code for a simple web application built with Python and Flask. The primary purpose of this project is to serve as a practical, hands-on demonstration of a complete, end-to-end Continuous Integration and Continuous Deployment (CI/CD) pipeline built with Jenkins, Docker, and AWS.
https://github.com/adityakonda6/python-app-pipeline

aws aws-ec2 docker flask git jenkins linux python webhook

Last synced: 3 months ago
JSON representation

This repository contains the source code for a simple web application built with Python and Flask. The primary purpose of this project is to serve as a practical, hands-on demonstration of a complete, end-to-end Continuous Integration and Continuous Deployment (CI/CD) pipeline built with Jenkins, Docker, and AWS.

Awesome Lists containing this project

README

          

# CI/CD Pipeline for a Python Flask Application

## ๐Ÿ“– Project Summary
This project demonstrates a complete, end-to-end Continuous Integration and Continuous Deployment (CI/CD) pipeline for a simple web application built with **Python** and **Flask**. The primary goal is to showcase a fully automated workflow that takes code from a `git push` and deploys it as a live Docker container on an AWS EC2 instance without any manual intervention.

---

## ๐Ÿ›๏ธ Architecture Diagram
The pipeline follows a logical, event-driven workflow. A `git push` to the main branch initiates a sequence of automated steps, as illustrated below.

**Workflow Breakdown:**
`Git Push` โ†’ `GitHub Webhook` โ†’ `Jenkins Server` โ†’ `Build & Test` โ†’ `Build Docker Image` โ†’ `Push to Docker Hub` โ†’ `Deploy to AWS EC2`

1. **Trigger:** A developer pushes code to the `main` branch on GitHub.
2. **CI Server:** A GitHub Webhook notifies the Jenkins server, which automatically triggers a new pipeline run.
3. **Build & Package:** Jenkins checks out the code, and using the `Dockerfile`, builds a new Docker image containing the Flask application and its dependencies.
4. **Registry:** The newly built image is tagged with a unique identifier and pushed to a Docker Hub repository.
5. **Deployment:** Jenkins securely connects to the production EC2 server, pulls the latest Docker image from Docker Hub, stops the old container, and starts a new one with the updated image.

---

## ๐Ÿ› ๏ธ Technologies Used
This project utilizes a modern DevOps toolchain to achieve full automation.

![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)
![Flask](https://img.shields.io/badge/Flask-000000?style=for-the-badge&logo=flask&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-2496ED?style=for-the-badge&logo=docker&logoColor=white)
![Jenkins](https://img.shields.io/badge/Jenkins-D24939?style=for-the-badge&logo=jenkins&logoColor=white)
![AWS](https://img.shields.io/badge/AWS-232F3E?style=for-the-badge&logo=amazon-aws&logoColor=white)
![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)
![Git](https://img.shields.io/badge/Git-F05032?style=for-the-badge&logo=git&logoColor=white)
![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)

---

## โš™๏ธ Setup and Execution (Local)
To run the Python application on your local machine without the pipeline.

### Prerequisites
* Python 3 and `pip` installed.
* `git` installed.

### Installation & Running
1. Clone the repository:
```sh
git clone [https://github.com/AdityaKonda6/python-app-pipeline.git](https://github.com/AdityaKonda6/python-app-pipeline.git)
```
2. Navigate to the project directory:
```sh
cd python-app-pipeline
```
3. Install the required packages:
```sh
pip install -r requirements.txt
```
4. Run the application:
```sh
python app.py
```
5. Open `http://127.0.0.1:80` in your browser.

---

## ๐Ÿ’ก Challenges & Solutions
This section documents a key technical challenge encountered during the pipeline setup and the steps taken to resolve it.

### Challenge: Jenkins Failing with Docker "Permission Denied"
A common and critical issue arose where the Jenkins pipeline would consistently fail during the Docker build stage.

* **Problem:** The Jenkins console output showed a clear error: `permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock`. This indicated that the `jenkins` user, which executes the pipeline, did not have the necessary permissions to interact with the Docker engine.

* **Diagnostic Process:**
1. I connected to the EC2 instance via SSH.
2. I switched from the default user to the `jenkins` user with the command: `sudo su - jenkins`.
3. I then tried to execute a basic Docker command, `docker ps`, to confirm the issue. This command failed with the exact same "permission denied" error, isolating the problem to a user-level permission issue on the host machine, not a flaw in the `Jenkinsfile` or Docker setup itself.

* **Solution:** On Linux systems, the Docker daemon socket is owned by the `root` user and the `docker` group. To allow a non-root user to run Docker commands, they must be added to the `docker` group.
1. I added the `jenkins` user to the `docker` group using the following command:
```sh
sudo usermod -aG docker jenkins
```
2. For the group membership changes to take effect, the Jenkins service needed to be restarted:
```sh
sudo systemctl restart jenkins
```
After restarting, the Jenkins pipeline executed successfully, as the user now had the required permissions to communicate with the Docker socket.

-----

## Hey there ๐Ÿ‘‹, I'm [Aditya!](https://github.com/AdityaKonda6)

[![Linkedin Badge](https://img.shields.io/badge/-LinkedIn-0e76a8?style=flat-square&logo=Linkedin&logoColor=white)](https://www.linkedin.com/in/aditya-adi-konda/)
[![Twitter Badge](https://img.shields.io/badge/-Twitter-00acee?style=flat-square&logo=Twitter&logoColor=white)](https://twitter.com/AdityaKonda7)
[![Instagram Badge](https://img.shields.io/badge/-Instagram-e4405f?style=flat-square&logo=Instagram&logoColor=white)](https://www.instagram.com/konda_aditya/)

### Glad to see you here! ย  ![](https://visitor-badge.glitch.me/badge?page_id=adityakonda.adityakonda&style=flat-square&color=0088cc)

Iโ€™m a **2025 IT Graduate** passionate about **DevOps, Cloud, and Software Development** ๐Ÿš€.
My mission? To **bridge the gap between development and operations**โ€”building scalable systems, automating workflows, and ensuring quality from code to deployment.

With a strong foundation in **Java, SQL, Linux**, and hands-on experience with **CI/CD pipelines, Selenium automation, cloud services, and Android development**, I thrive in solving problems end-to-endโ€”from writing code to deploying it in production.

Recently, at **CWD Limited**, I worked on:
- **Automation Testing Frameworks** (Selenium, Java, Maven)
- **Linux-based system configurations & debugging**
- **Hardware-software integration testing**
- API testing with Postman
โ€ฆand in the process, strengthened my DevOps skill set.

๐Ÿ’ก Curious mind. Fast learner. Always ready to build, break, and rebuildโ€”better.

---

### ๐Ÿš€ What Iโ€™m Working On:
- Building **DevOps projects** (Jenkins, Docker, Kubernetes, AWS, Ansible)
- Enhancing **automation frameworks** for testing & deployment
- Crafting **Android apps** and backend services
- Expanding my **Linux administration** skills

---

### ๐Ÿ’ผ My Tech Stack:
Java
Linux
Docker
Kubernetes
AWS
Python
JavaScript
React
SQL
Git
nodejs
mongodb
terminal

---

### ๐Ÿ“Œ Highlights:
- ๐Ÿ›  Built **dynamic Selenium automation scripts** integrated with Maven
- ๐Ÿš€ Created & deployed **full-stack and Android applications**
- ๐Ÿง Comfortable with **Linux system administration & shell scripting**
- ๐Ÿ“ฆ Implemented CI/CD workflows for smoother deployments
- โ˜๏ธ Learning & applying **cloud infrastructure concepts**

--

### ๐Ÿ“ซ How to Reach Me:
- Email: **adityakonda04@gmail.com**
- Portfolio: [adityakonda04.vercel.app](https://adityakonda04.vercel.app/)
- LinkedIn: [Aditya Adi Konda](https://www.linkedin.com/in/aditya-adi-konda/)

---

### ๐Ÿ“Š GitHub Stats:

โšก GitHub Stats



๐Ÿ”ฅ GitHub Streaks


โ˜„๏ธ LeetCode Stats


---

๐Ÿ’ฌ Always open to collaborations, tech discussions, and exploring new opportunities in **DevOps, Cloud, and Software Development**.

Like My Work?

Buy Me A Coffee

AdityaKonda6

AdityaKonda6

### Show some โค๏ธ by starring some of the repositories!
### My Portfolio