This project demonstrates a production-ready 3-tier microservice-based Voting App deployed using Azure DevOps CI/CD pipelines, Azure Kubernetes Service (AKS), and ArgoCD GitOps workflows. It showcases modern DevOps practices including containerization, microservices architecture, continuous integration/deployment, and GitOps.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3-Tier Microservice Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Tier 1: Presentation Layer (Frontend) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β React.js Application β β
β β β’ Modern UI with Tailwind CSS β β
β β β’ Responsive design β β
β β β’ Real-time results β β
β β β’ Vote casting interface β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Tier 2: Application Layer (Backend) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β FastAPI Backend Service β β
β β β’ RESTful API endpoints β β
β β β’ Vote processing logic β β
β β β’ Data validation β β
β β β’ Authentication & authorization β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Tier 3: Data Layer (Database) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MongoDB Database β β
β β β’ Poll storage β β
β β β’ Vote records β β
β β β’ User sessions β β
β β β’ Real-time aggregation β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Create Polls: Interactive poll creation with multiple options
- Cast Votes: Secure voting system with IP-based validation
- Real-time Results: Live vote counting and percentage calculations
- Responsive Design: Mobile-first UI with Tailwind CSS
- Poll Management: Create, view, and manage polls
- Containerization: Docker containers for each service
- Microservices: Independent, scalable services
- CI/CD Pipelines: Azure DevOps automated pipelines
- GitOps: ArgoCD for continuous deployment
- Infrastructure as Code: Kubernetes manifests
- Monitoring: Health checks and observability
- Security: Container scanning and security policies
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React.js, Tailwind CSS | User interface and experience |
| Backend | FastAPI, Python | API services and business logic |
| Database | MongoDB | Data persistence and storage |
| Container | Docker | Application containerization |
| Orchestration | Kubernetes (AKS) | Container orchestration |
| CI/CD | Azure DevOps | Continuous integration/deployment |
| GitOps | ArgoCD | Declarative deployment |
| Monitoring | Prometheus, Grafana | Observability and metrics |
aks-argocd-voting-app/
βββ frontend/ # React application (Tier 1)
β βββ src/
β β βββ components/ # React components
β β βββ pages/ # Application pages
β β βββ services/ # API services
β βββ Dockerfile # Frontend container
β βββ package.json # Dependencies
βββ backend/ # FastAPI application (Tier 2)
β βββ app/
β β βββ models/ # Data models
β β βββ routes/ # API routes
β β βββ main.py # Application entry
β βββ Dockerfile # Backend container
β βββ requirements.txt # Python dependencies
βββ database/ # MongoDB configuration (Tier 3)
β βββ init.js # Database initialization
βββ k8s/ # Kubernetes manifests
β βββ base/ # Base configurations
β βββ namespace.yaml # Namespace definition
β βββ mongo.yaml # Database deployment
β βββ backend.yaml # Backend deployment
β βββ frontend.yaml # Frontend deployment
β βββ ingress.yaml # Load balancer
βββ argocd/ # ArgoCD GitOps
β βββ project.yaml # ArgoCD project
β βββ app.yaml # Application definition
βββ .azure-pipelines/ # CI/CD pipelines
β βββ frontend-pipeline.yml # Frontend pipeline
β βββ backend-pipeline.yml # Backend pipeline
β βββ shared-steps.yml # Shared pipeline steps
βββ scripts/ # Deployment scripts
β βββ deploy-local.sh # Local deployment
β βββ k8s-deploy.sh # Kubernetes deployment
βββ docker-compose.yml # Local development
βββ README.md # This file
- Docker & Docker Compose
- Node.js 18+ (for local development)
- Python 3.11+ (for local development)
- kubectl (for Kubernetes deployment)
- Azure CLI (for AKS deployment)
-
Clone the repository
git clone https://github.com/your-org/aks-argocd-voting-app.git cd aks-argocd-voting-app -
Start with Docker Compose
chmod +x scripts/deploy-local.sh ./scripts/deploy-local.sh up
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8001
- API Documentation: http://localhost:8001/docs
-
View logs
./scripts/deploy-local.sh logs
-
Deploy to Kubernetes
chmod +x scripts/k8s-deploy.sh ./scripts/k8s-deploy.sh deploy
-
Setup ArgoCD
./scripts/k8s-deploy.sh argocd
-
Check deployment status
./scripts/k8s-deploy.sh status
-
Frontend Pipeline (
frontend-pipeline.yml)- Code linting and testing
- Docker image build and push
- Kubernetes deployment
- Health checks
-
Backend Pipeline (
backend-pipeline.yml)- Code quality checks (Black, Flake8)
- Security scanning (Bandit, Safety)
- Unit and integration tests
- Docker image build and push
- Database migrations
- API health checks
-
Build & Test
- Code quality checks
- Security scans
- Unit tests
- Container image build
-
Deploy
- Kubernetes deployment
- GitOps sync
- Health verification
-
Post-Deploy
- Integration tests
- Performance tests
- Notifications
- Project:
voting-app-project- Defines access controls and policies - Application:
voting-app- Manages the deployment lifecycle - Sync Policy: Automated sync with self-healing enabled
- Health Checks: Custom health checks for all services
- Code changes pushed to Git
- Azure DevOps builds and pushes container images
- Pipeline updates Kubernetes manifests
- ArgoCD detects changes and syncs
- Application deployed to AKS
- Frontend: HTTP health endpoint
- Backend:
/api/healthendpoint with database connectivity - Database: MongoDB ping command
- Kubernetes resource metrics
- Application performance metrics
- Custom business metrics (votes, polls)
- Log aggregation and analysis
- Non-root user containers
- Security scanning with Trivy/Aqua
- Minimal base images
- Regular updates
- Network policies
- Pod security policies
- RBAC (Role-Based Access Control)
- Secrets management
- Input validation
- SQL injection prevention
- XSS protection
- CORS configuration
- Infrastructure as Code: All infrastructure defined in code
- GitOps: Declarative deployments with ArgoCD
- Microservices: Loosely coupled, independently deployable services
- Continuous Integration: Automated testing and builds
- Continuous Deployment: Automated deployments with rollback capability
- Monitoring: Comprehensive observability and alerting
- Security: Security scanning and best practices
- Scalability: Horizontal pod autoscaling
# Start local environment
./scripts/deploy-local.sh up
# View logs
./scripts/deploy-local.sh logs
# Stop services
./scripts/deploy-local.sh down# Deploy to K8s
./scripts/k8s-deploy.sh deploy
# Setup ArgoCD
./scripts/k8s-deploy.sh argocd
# Check status
./scripts/k8s-deploy.sh status# Create AKS cluster
az aks create --resource-group voting-app-rg --name voting-app-aks
# Get credentials
az aks get-credentials --resource-group voting-app-rg --name voting-app-aks
# Deploy application
./scripts/k8s-deploy.sh deploy# Backend tests
cd backend
python -m pytest
# Frontend tests
cd frontend
npm test
# Integration tests
./scripts/test-integration.sh- Health check endpoints
- Load testing with k6
- End-to-end testing
- Performance monitoring
# HPA configuration included in manifests
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70# Scale frontend
./scripts/k8s-deploy.sh scale frontend 5
# Scale backend
./scripts/k8s-deploy.sh scale backend 3- Port conflicts: Ensure ports 3000, 8001, 27017 are available
- Docker issues: Restart Docker daemon
- Kubernetes connectivity: Check kubectl configuration
- Service health: Use health check endpoints
# Check pod logs
kubectl logs -f deployment/backend -n voting-app
# Execute into pod
kubectl exec -it deployment/backend -n voting-app -- /bin/bash
# Port forward for debugging
kubectl port-forward svc/backend-service 8001:8001 -n voting-app- Fork the repository
- Create a feature branch (
git checkout -b feature/new-feature) - Commit changes (
git commit -am 'Add new feature') - Push to branch (
git push origin feature/new-feature) - Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: devops@company.com
- FastAPI for the excellent Python web framework
- React for the frontend framework
- Tailwind CSS for the styling framework
- ArgoCD for GitOps capabilities
- Azure DevOps for CI/CD pipelines