This project demonstrates a production-ready DevOps workflow for a Django web application using Docker, Jenkins CI/CD, and AWS EC2. The application is containerized and deployed using Docker Compose, with an automated CI/CD pipeline that handles build, test, and deployment.
Goal: To showcase real-world DevOps practices including containerization, CI/CD automation, cloud deployment, and infrastructure reliability.
Developer β GitHub β Jenkins CI/CD β Docker Build
β
AWS EC2 Instance
(Docker + Compose)
β
Django App + PostgreSQL
| Category | Technology |
|---|---|
| Backend | Django (Python) |
| Database | PostgreSQL |
| Containerization | Docker, Docker Compose |
| CI/CD | Jenkins |
| Cloud | AWS EC2 |
| OS | Ubuntu Linux |
| Version Control | Git & GitHub |
The Jenkins pipeline is triggered automatically on every code push to the main branch.
- Code Checkout β Pull latest code from GitHub
- Build Docker Images β Build Django & PostgreSQL containers
- Run Tests β Execute Django unit tests inside containers
- Push Changes β Update Docker images
- Deploy to AWS EC2 β Restart containers using Docker Compose
- Zero manual deployment
- Faster release cycles
- Reduced human error
- Production-like CI/CD workflow
- Django backend runs inside a Docker container
- PostgreSQL runs as a separate container
- Docker Compose manages multi-container orchestration
- Environment variables handled via
.envfile
webβ Django applicationdbβ PostgreSQL database
-
EC2 Instance (Ubuntu)
-
Security Groups configured for:
- SSH (22)
- HTTP (80)
-
Docker & Docker Compose installed on EC2
-
Jenkins hosted locally / separate server
- Environment variables stored securely
.envfile excluded using.gitignore- Database credentials not hardcoded
- SSH key-based EC2 access
- Jenkins credentials managed securely
git clone https://github.com/your-username/project-name.git
cd project-name
docker-compose up --buildAccess the application:
http://localhost:8000
- Add Kubernetes (EKS) deployment
- Implement Terraform for IaC
- Enable HTTPS using Nginx & SSL
- Add monitoring (Prometheus + Grafana)
- Blue-Green deployment strategy
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Layer β
β (Browsers, Mobile) β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β HTTP/HTTPS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AWS EC2 Instance β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Nginx Reverse Proxy β β
β β β’ SSL/TLS Termination β β
β β β’ Load Balancing β β
β β β’ Static/Media File Serving β β
β β β’ Compression (Gzip) β β
β βββββββββββββ¬ββββββββββββββββββββββββββββββββββββ¬ββββββββββ β β
β β β β
β β http://web:8000 β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ β
β β Django Application β β Static Files Volume β β
β β (Gunicorn WSGI) β β /vol/web/static β β
β β β’ Blog Management β ββββββββββββββββββββββββ β
β β β’ User Auth β β
β β β’ Admin Panel β ββββββββββββββββββββββββ β
β β β β Media Files Volume β β
β β β β /vol/web/media β β
β ββββββββββββ¬ββββββββββββ ββββββββββββββββββββββββ β
β β β
β β psycopg2 tcp://db:5432 β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PostgreSQL Database β β
β β β’ User Data β β
β β β’ Blog Posts β β
β β β’ Categories β β
β β β’ Media Metadata β β
β β (Persistent Storage: postgres_data volume) β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β β Jenkins CI/CD Deployment β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
βββββββββββββββββββββββββββββββββββββββββββ€
β Django 5.0.6 β
β β’ URL Routing (urls.py) β
β β’ Views (views.py) β
β β’ Models (models.py) β
β β’ Forms (forms.py) β
β β’ Admin Interface (admin.py) β
β β’ Middleware Stack β
β β’ Template Engine β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β WSGI Application Server β
βββββββββββββββββββββββββββββββββββββββββββ€
β Gunicorn 25.0.3 β
β β’ Worker Pool (sync workers) β
β β’ Request Threading β
β β’ Graceful Shutdown β
β β’ Bind: 0.0.0.0:8000 β
βββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β Database Layer β
βββββββββββββββββββββββββββββββββββββββββββ€
β PostgreSQL 15 β
β β’ Psycopg2 Adapter β
β β’ Connection Pooling β
β β’ Transactions Support β
β β’ ACID Compliance β
βββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββ
β Container Orchestration β
ββββββββββββββββββββββββββββββββ€
β Docker-Compose β
β β’ Service Definition β
β β’ Network Configuration β
β β’ Volume Management β
β β’ Environment Setup β
ββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββ
β Containerization β
ββββββββββββββββββββββββββββββββ€
β Docker β
β β’ Image Building β
β β’ Container Management β
β β’ Networking β
β β’ Storage β
ββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββ
β Cloud Infrastructure β
ββββββββββββββββββββββββββββββββ€
β AWS EC2 β
β β’ Compute Instance β
β β’ Security Groups β
β β’ Elastic IPs β
β β’ Storage (EBS) β
ββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββ
β Default Docker Network β
β (saikrupa_default) β
β β
β ββββββββββββ ββββββββββββ β
β β postgres β β web β β
β β (db) β β (web) β β
β β 5432 β β 8000 β β
β ββββββ¬ββββββ ββββββ¬ββββββ β
β β β β
β βββββββββββββββΌββββββββββββββββΌβββ
β β β β
β ββββββββΌβββββββββ β β
β β nginx β β β
β β 80, 443 β β β
β βββββββββββββββββ β β
β β β
ββββββββββββββββββββββββββββββββββββββ β
β
ββββββββββββββββββββββββββββββββ
β
ββββββΌβββββββββ
β Host β
β localhost β
β Port 80 β
βββββββββββββββ
π Full deployment setup: See DEPLOYMENT.md
Built with a focus on automation, reliability, and production-grade DevOps practices.