9a23c1c05b9e1a174a2941b10e5a3283351221e6
Some checks failed
CI/CD Pipeline - Build, Test, and Deploy / 🧪 Test & Lint (push) Failing after 4m51s
CI/CD Pipeline - Build, Test, and Deploy / 🔒 Security Scan (push) Successful in 9m31s
CI/CD Pipeline - Build, Test, and Deploy / 🏗️ Build & Push Image (push) Has been skipped
CI/CD Pipeline - Build, Test, and Deploy / 🛡️ Image Security Scan (push) Has been skipped
CI/CD Pipeline - Build, Test, and Deploy / 🚀 Deploy to Development (push) Has been skipped
CI/CD Pipeline - Build, Test, and Deploy / 🏭 Deploy to Production (push) Has been skipped
CI/CD Pipeline - Build, Test, and Deploy / 🧹 Cleanup (push) Successful in 1s
harbor-ci-cd-demo
Learning Harbor + Gitea Actions CI/CD integration
🖥️ System Monitoring Dashboard
A comprehensive Node.js application for real-time system monitoring with a beautiful web dashboard. Built to demonstrate Harbor CI/CD integration with Gitea Actions.
✨ Features
- 🚀 Real-time System Monitoring: CPU, memory, disk usage, and load averages
- 📊 Interactive Dashboard: Beautiful, responsive web interface with live data
- 🔍 Health Checks: Kubernetes-style readiness and liveness probes
- 📡 REST API: Complete API for system metrics and monitoring data
- 🧪 Comprehensive Testing: Unit tests with coverage reporting
- 🔒 Security: Helmet.js security headers, input validation
- 📈 Metrics Collection: Request tracking, response times, error rates
- 🐳 Container Ready: Optimized Docker configuration
- ⚡ Production Ready: Proper error handling, logging, and monitoring
🚀 Quick Start
Prerequisites
- Node.js 18+
- Docker (optional)
- Git
Local Development
# Clone the repository
git clone https://git.maverickapplications.com/[username]/harbor-ci-cd-demo.git
cd harbor-ci-cd-demo
# Install dependencies
npm install
# Start development server
npm run dev
# Open your browser
open http://localhost:3000
Using Docker
# Build and run with Docker
docker build -t monitoring-dashboard .
docker run -p 3000:3000 monitoring-dashboard
# Or use Docker Compose
docker-compose up
📚 API Documentation
System Information
- GET /api/system - System hardware and OS information
- GET /api/memory - Memory usage statistics
- GET /api/process - Node.js process information
- GET /api/metrics - Application metrics and counters
Health Checks
- GET /health - Basic health status
- GET /health/detailed - Comprehensive health information
- GET /health/ready - Readiness probe (Kubernetes compatible)
- GET /health/live - Liveness probe (Kubernetes compatible)
Testing
- GET /api/test - API connectivity test endpoint
🧪 Testing
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Run linting
npm run lint
# Fix linting issues
npm run lint:fix
📊 Dashboard Features
System Overview
- Hostname, platform, and architecture
- CPU cores and load averages
- Total system memory
- System uptime
- Node.js version information
Memory Monitoring
- System memory usage with visual bars
- Process heap memory tracking
- RSS and external memory statistics
- Warning indicators for high usage
Health Status
- Overall system health indicator
- Memory status monitoring
- Process uptime tracking
- Environment information
API Metrics
- Request counters by endpoint
- Average response times
- Service uptime tracking
- Real-time performance data
Process Information
- Process ID and parent process
- Working directory
- Node.js version details
- Environment configuration
🔧 Configuration
Environment Variables
PORT=3000 # Server port (default: 3000)
NODE_ENV=production # Environment mode
Docker Environment
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
🐳 Container Deployment
Building the Image
# Build locally
docker build -t monitoring-dashboard:latest .
# Build for Harbor registry
docker build -t registry.maverickapplications.com/infrastructure/monitoring-dashboard:latest .
Running in Production
# Run with resource limits
docker run -d \
--name monitoring-dashboard \
--memory=512m \
--cpus=1 \
-p 3000:3000 \
-e NODE_ENV=production \
--restart=unless-stopped \
monitoring-dashboard:latest
🔄 CI/CD Pipeline
This application includes a complete CI/CD pipeline with:
- 🧪 Automated Testing: Unit tests and coverage reporting
- 🔒 Security Scanning: npm audit and vulnerability checks
- 🏗️ Multi-platform Builds: AMD64 and ARM64 support
- 📦 Harbor Integration: Automatic image building and pushing
- 🛡️ Vulnerability Scanning: Trivy security scanning
- 🚀 Automated Deployment: Environment-based deployment
- 📋 SBOM Generation: Software Bill of Materials
Pipeline Stages
- Test & Lint - Code quality and functionality validation
- Security Scan - Dependency vulnerability checking
- Build & Push - Multi-platform Docker image creation
- Image Scan - Container vulnerability assessment
- Deploy - Environment-specific deployment
- Cleanup - Resource management
📈 Monitoring & Observability
Health Check Endpoints
# Basic health check
curl http://localhost:3000/health
# Detailed health information
curl http://localhost:3000/health/detailed
# Kubernetes readiness probe
curl http://localhost:3000/health/ready
# Kubernetes liveness probe
curl http://localhost:3000/health/live
Metrics Collection
The application automatically tracks:
- HTTP request counters
- Response time histograms
- Error rate monitoring
- Memory usage patterns
- System resource utilization
Dashboard Access
- Main Dashboard: http://localhost:3000
- API Documentation: http://localhost:3000/api
- Health Status: http://localhost:3000/health/detailed
🛠️ Development
Project Structure
harbor-ci-cd-demo/
├── .gitea/workflows/ # CI/CD pipeline configuration
├── src/ # Application source code
│ ├── routes/ # API route handlers
│ ├── middleware/ # Custom middleware
│ ├── utils/ # Utility functions
│ └── public/ # Frontend assets
├── tests/ # Test suites
├── Dockerfile # Container configuration
├── docker-compose.yml # Local development setup
└── package.json # Node.js configuration
Adding New Features
- API Endpoints: Add routes in
src/routes/ - Middleware: Create middleware in
src/middleware/ - Tests: Add tests in
tests/directory - Frontend: Update dashboard in
src/public/
Code Style
- ESLint configuration with recommended rules
- Prettier formatting (optional)
- Jest testing framework
- Security-first approach
🔒 Security Features
- Helmet.js: Security headers and protections
- CORS: Cross-origin resource sharing control
- Input Validation: Request data validation
- Error Handling: Secure error responses
- Health Checks: System monitoring capabilities
- Container Security: Non-root user execution
📖 Learn More
This application demonstrates:
- Modern Node.js Development: ES6+, async/await, modules
- RESTful API Design: Resource-based endpoints
- Real-time Monitoring: Live system metrics
- Container Best Practices: Multi-stage builds, security
- CI/CD Integration: Automated testing and deployment
- Production Readiness: Logging, monitoring, health checks
🤝 Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📄 License
MIT License - see LICENSE file for details
Built with ❤️ for Harbor CI/CD Demo
This application showcases enterprise-grade Node.js development with comprehensive monitoring, testing, and deployment automation.
Description
Languages
JavaScript
79.1%
CSS
9.6%
Dockerfile
6.4%
HTML
4.9%