A comprehensive end-to-end DevOps teaching application demonstrating modern CI/CD practices, containerization, and cloud deployment strategies using Node.js, Docker, GitHub Actions, and Azure Kubernetes Service.
- Features
- Architecture
- Getting Started
- Development
- Testing
- Docker
- CI/CD Pipeline
- Deployment
- API Documentation
- Security
- Monitoring
- Contributing
- Express.js Web Application with MVC architecture
- RESTful API with health checks and metrics endpoints
- EJS Templates for server-side rendering
- Security Headers via Helmet.js
- Rate Limiting for API protection
- Compression for optimized performance
- Automated CI/CD with GitHub Actions
- Docker Containerization with multi-stage builds
- Kubernetes Deployment to Azure AKS
- Automated Testing with Jest (unit & integration)
- Code Quality with ESLint
- Security Scanning with CodeQL
- Dependency Management with Dependabot
- Infrastructure as Code with Kubernetes manifests
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββ
β GitHub Repo ββββββΆβGitHub ActionsββββββΆβ Container β
β β β CI/CD β β Registry β
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββ βββββββββββββββ
β CodeQL β β Azure AKS β
β Scanning β β Production β
ββββββββββββββββ βββββββββββββββ
- Node.js 18+ and npm 9+
- Docker Desktop
- Git
- Azure CLI (for deployment)
- kubectl (for Kubernetes management)
- Clone the repository:
git clone https://github.com/your-org/devops-e2e.git
cd devops-e2e- Install dependencies:
npm install- Create environment file:
cp .env.example .env
# Edit .env with your configuration- Run the application:
npm start
# or for development with hot-reload
npm run dev- Open browser to http://localhost:3000
devops-e2e/
βββ src/
β βββ app.js # Main application entry
β βββ controllers/ # Route controllers
βββ views/ # EJS templates
βββ public/ # Static assets
β βββ css/
β βββ js/
βββ tests/
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
βββ .github/
β βββ workflows/ # GitHub Actions workflows
βββ k8s/ # Kubernetes manifests
βββ docker-compose.yml # Docker compose config
βββ package.json # Node.js dependencies
npm start # Start production server
npm run dev # Start development server with nodemon
npm test # Run all tests with coverage
npm run test:watch # Run tests in watch mode
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint issues# Run all tests
npm test
# Run unit tests only
npm run test:unit
# Run integration tests only
npm run test:integration
# Run with watch mode
npm run test:watchTests aim for 80%+ coverage across:
- Lines
- Statements
- Functions
- Branches
Coverage reports are generated in coverage/ directory.
# Build locally
docker build -t devops-e2e .
# Run container
docker run -p 3000:3000 devops-e2e# Start all services
docker-compose up
# Start with development configuration
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
# Stop all services
docker-compose down-
CI/CD Pipeline (
ci-cd.yml)- Triggered on push to main/develop
- Runs tests and linting
- Builds and pushes Docker image
- Deploys to staging/production
-
Security Scanning (
codeql.yml)- Runs CodeQL analysis
- Scans for vulnerabilities
- Reports security alerts
-
Dependency Updates (
dependabot.yml)- Weekly dependency checks
- Automated pull requests
- Grouped updates
-
Test & Lint
- Install dependencies
- Run ESLint
- Execute Jest tests
- Generate coverage reports
-
Build
- Multi-stage Docker build
- Push to GitHub Container Registry
- Tag with branch/version
-
Deploy
- Staging deployment (develop branch)
- Production deployment (main branch)
- Smoke tests
# Login to Azure
az login
# Set subscription
az account set --subscription <subscription-id>
# Get AKS credentials
az aks get-credentials --resource-group <rg-name> --name <cluster-name># Apply Kubernetes manifests
kubectl apply -f k8s/
# Verify deployment
kubectl get pods -n devops-e2e
kubectl get services -n devops-e2e# Scale deployment
kubectl scale deployment devops-e2e --replicas=3 -n devops-e2e
# Enable autoscaling
kubectl autoscale deployment devops-e2e --min=2 --max=10 --cpu-percent=80 -n devops-e2eGET /- Home pageGET /about- About pageGET /contact- Contact page
GET /api/status- Application statusGET /api/metrics- System metricsPOST /api/feedback- Submit feedback
GET /health- Overall health statusGET /health/ready- Readiness probeGET /health/live- Liveness probe
# Check status
curl http://localhost:3000/api/status
# Get metrics
curl http://localhost:3000/api/metrics
# Submit feedback
curl -X POST http://localhost:3000/api/feedback \
-H "Content-Type: application/json" \
-d '{"message":"Great app!","rating":5}'- Helmet.js for security headers
- Rate limiting on API endpoints
- Input validation and sanitization
- CodeQL security scanning
- Dependabot for dependency updates
- Non-root Docker user
- Secret management via environment variables
- Never commit secrets to repository
- Use Azure Key Vault for production secrets
- Enable RBAC in Kubernetes
- Regular security audits
- Keep dependencies updated
- Request count and response times
- Memory usage and heap statistics
- CPU utilization
- Error rates
- Prometheus - Metrics collection
- Grafana - Visualization
- Azure Monitor - Cloud monitoring
- Application Insights - APM
# Start monitoring stack
docker-compose up prometheus grafana
# Access dashboards
# Prometheus: http://localhost:9090
# Grafana: http://localhost:3001 (admin/admin)- Fork the repository
- Create 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 Pull Request
- Follow ESLint configuration
- Write tests for new features
- Maintain 80%+ test coverage
- Update documentation
- Follow conventional commits
- Unit tests pass
- Integration tests pass
- ESLint passes
- Docker build succeeds
- Documentation updated
- Node.js Best Practices
- Docker Documentation
- Kubernetes Documentation
- GitHub Actions Documentation
- Azure AKS Documentation
- Twelve-Factor App methodology
- Container orchestration
- GitOps principles
- Infrastructure as Code
- Continuous Integration/Deployment
- Security scanning and compliance
- Monitoring and observability
This project is licensed under the MIT License - see the LICENSE file for details.
For questions and support:
- Open an issue on GitHub
- Check existing documentation
- Review closed issues for solutions
Built with teaching DevOps best practices in mind π