A complete DevOps demonstration project featuring a Python Flask application with full CI/CD pipeline, Infrastructure as Code, and GitOps deployment using ArgoCD. This project showcases modern DevOps practices with automated testing, containerization, infrastructure provisioning, and continuous deployment.
This project implements a complete DevOps stack:
- Application: Python Flask web service
- Containerization: Docker with multi-stage builds
- Infrastructure: Terraform with Minikube for local Kubernetes
- GitOps: ArgoCD for continuous deployment
- CI/CD: GitHub Actions with automated testing and deployment
- Monitoring: Built-in health checks and readiness probes
devops-project/
├── .github/workflows/ # CI/CD Pipelines
│ └── ci.yaml # GitHub Actions workflow
├── src/ # 🐍 Application Source Code
│ ├── app.py # Flask web application
│ └── Dockerfile # Container definition
├── infrastructure/ # 🏗️ Infrastructure as Code
│ ├── main.tf # Main Terraform configuration
│ ├── providers.tf # Provider configurations
│ ├── variables.tf # Input variables
│ ├── argocd.tf # ArgoCD deployment
│ └── backend.tf # State backend configuration
├── k8s/ # ☸️ Kubernetes Configurations
│ ├── helm/devops-app/ # Helm chart for application
│ │ ├── Chart.yaml # Helm chart metadata
│ │ ├── values.yaml # Configuration values
│ │ └── templates/ # Kubernetes manifests
│ └── argocd/ # ArgoCD Application definitions
│ └── application.yaml # ArgoCD app configuration
├── docs/ # 📚 Documentation
├── scripts/ # 🔧 Utility scripts
└── README.md # This file
- Docker - For containerization
- Terraform (v1.5+) - For infrastructure provisioning
- kubectl - For Kubernetes cluster interaction
- Minikube - For local Kubernetes cluster
- Python 3.9+ - For local development
- Docker Hub Account - For pushing container images
Before getting started, you'll need to configure your Docker Hub credentials for the CI/CD pipeline:
- Fork this repository to your GitHub account
- Update Docker image references:
- Replace
YOUR_USERNAMEwith your Docker Hub username in:.github/workflows/ci.yamlk8s/helm/devops-app/values.yaml- Badge URLs in this README
- Replace
- Add GitHub Secrets for Docker Hub integration:
DOCKER_USERNAME: Your Docker Hub usernameDOCKER_PASSWORD: Your Docker Hub access token
git clone https://github.com/ozzyib/devops-project.git
cd devops-project
# Install Python dependencies (for local development)
pip install flask pytest# Run the Flask app locally
cd src/
python app.py
# Test the application
curl http://localhost:8080
curl http://localhost:8080/health# Navigate to infrastructure directory
cd infrastructure/
# Initialize Terraform
terraform init
# Create local Kubernetes cluster and deploy ArgoCD
terraform plan
terraform apply
# Verify cluster is running
kubectl get nodes
kubectl get pods -n argocdThe application automatically deploys through ArgoCD once the infrastructure is ready:
# Check ArgoCD application status
kubectl get applications -n argocd
# Port forward to ArgoCD UI (optional)
kubectl port-forward service/argocd-server -n argocd 8081:443
# Access ArgoCD UI at https://localhost:8081
# Username: admin
# Password: kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d🔒 Security Note: This password is for local development only. Each deployment generates a unique password that's only accessible on your local machine (localhost). For production deployments, always change the default password and implement proper RBAC.
## 🔄 CI/CD Pipeline
The GitHub Actions pipeline automatically:
### 🧪 Test Stage
- ✅ Runs Flask application tests
- ✅ Validates Python code quality
- ✅ Ensures application health endpoints respond correctly
### 🐳 Build & Push Stage
- ✅ Builds Docker image with commit SHA tag
- ✅ Tests containerized application
- ✅ Pushes to Docker Hub (`YOUR_USERNAME/devops-project`)
- ✅ Updates Helm chart values with new image tag
### 🏗️ Infrastructure Validation
- ✅ Validates Terraform configuration formatting
- ✅ Runs `terraform plan` to verify infrastructure changes
- ✅ Ensures infrastructure code quality
### 🔄 GitOps Deployment
- ✅ ArgoCD automatically detects Helm chart changes
- ✅ Deploys new application version to Kubernetes
- ✅ Provides rollback capabilities and deployment history
## 🌐 Application Endpoints
| Endpoint | Method | Description |
|----------|---------|-------------|
| `/` | GET | Returns current timestamp with emoji |
| `/health` | GET | Health check endpoint for probes |
| `/time` | GET | Current server time in JSON format |
## 🛠️ Technology Stack
### Application Layer
- **Flask** - Lightweight Python web framework
- **Python 3.9** - Runtime environment
- **Gunicorn** - Production WSGI server
### Container & Orchestration
- **Docker** - Application containerization
- **Kubernetes** - Container orchestration
- **Minikube** - Local Kubernetes development
- **Helm** - Kubernetes package manager
### Infrastructure & GitOps
- **Terraform** - Infrastructure as Code
- **ArgoCD** - GitOps continuous deployment
- **GitHub Actions** - CI/CD automation
### Monitoring & Observability
- **Kubernetes Probes** - Health checking
- **Docker Health Checks** - Container monitoring
## 🔧 Development Workflow
1. **Code Changes** → Push to GitHub
2. **CI Pipeline** → Automated testing and Docker build
3. **Image Push** → New tagged image to Docker Hub
4. **Helm Update** → Automatic values.yaml update with new image tag
5. **ArgoCD Sync** → Detects changes and deploys to Kubernetes
6. **Health Checks** → Verifies deployment success
## 📊 Monitoring & Operations
### Health Checks
```bash
# Check application health
kubectl get pods
kubectl describe pod <pod-name>
# View application logs
kubectl logs -l app.kubernetes.io/name=devops-app
# Check ArgoCD sync status
kubectl get applications -n argocd
# Debug infrastructure
cd infrastructure/
terraform plan
terraform refresh
# Check ArgoCD status
kubectl get pods -n argocd
kubectl logs -n argocd deployment/argocd-application-controller- Change Default Passwords: Update ArgoCD admin password immediately
- RBAC: Implement Role-Based Access Control for ArgoCD and Kubernetes
- TLS/SSL: Enable proper TLS certificates (not self-signed)
- Network Policies: Restrict pod-to-pod communication
- Secret Management: Use HashiCorp Vault, AWS Secrets Manager, or sealed-secrets
- Monitoring: Add Prometheus, Grafana for metrics and alerting
- Logging: Implement centralized logging (ELK/EFK stack)
- Tracing: Add distributed tracing with Jaeger or Zipkin
- Scaling: Configure HPA (Horizontal Pod Autoscaler)
- Backup: Implement etcd backups and disaster recovery plans
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This project demonstrates:
- ✅ Complete CI/CD pipeline implementation
- ✅ Infrastructure as Code with Terraform
- ✅ GitOps deployment patterns with ArgoCD
- ✅ Kubernetes application deployment and management
- ✅ Docker containerization best practices
- ✅ Automated testing and quality assurance
- ✅ Modern DevOps toolchain integration
Built with ❤️ for learning DevOps practices