This project implements a full-stack web application and a robust observability pipeline using:
- Prometheus for metrics scraping
- Grafana for visualization
- Alertmanager for alerts
- Loki + Promtail for log aggregation
- Docker Compose to orchestrate everything
.
├── frontend/ # Vite-based app
├── backend/ # Node.js api
|── cache/ # Redis cache
├── db/ # MongoDB data
├── proxy/ # Nginx reverse proxy
├── monitoring/
│ ├── prometheus.yml # Prometheus scrape config
│ └── alertmanager.yml # Alertmanager rules
| └── alert.rules.yml # Alertmanager rules
├── loki/
│ ├── loki-config.yml # Loki configuration
│ └── promtail-config.yml # Promtail configuration
|── Screenshots # screenshots of Grafana dashboards
├── docker-compose.yml
Service | Description | Port |
---|---|---|
frontend |
Vite frontend app | 5173 |
backend |
Node.js API connected to MongoDB and Redis | 5000 |
proxy |
Nginx reverse proxy | 80 |
database |
MongoDB database | 27017 |
cache |
Redis key-value store | 6379 |
prometheus |
Metrics scraping and alert evaluation | 9090 |
grafana |
Dashboards & visualizations | 3000 |
alertmanager |
Alert delivery via email/Slack/etc. | 9093 |
loki |
Log aggregator | 3100 |
promtail |
Log shipper for containers | 9080 |
mongo-exporter |
Exposes MongoDB metrics for Prometheus | 9216 |
redis-exporter |
Exposes Redis metrics for Prometheus | 9121 |
node-exporter |
Host-level system metrics | 9100 |
- Docker & Docker Compose installed
- Optional:
.env
file for Alertmanager SMTP settings:[email protected] SMTP_PASSWORD=your-app-password
-
Clone the repo
git clone https://github.com/vsbuidev/monitoring-setup.git cd monitoring-setup
-
Build and run the stack
docker compose up -d --build
-
Access Services:
- Frontend: http://localhost:5173
- Backend: http://localhost:5000
- Grafana: http://localhost:3000 (default user:
admin
/admin
) - Prometheus: http://localhost:9090
- Alertmanager: http://localhost:9093
- Loki Logs (via Grafana Explore tab)
- Prometheus scrapes metrics from:
node-exporter
: system metricsredis-exporter
,mongo-exporter
: DB metrics- Custom app metrics (if instrumented)
- Import dashboards from Grafana.com
- Node Exporter Full: ID
1860
- MongoDB: ID
2583
- Redis: ID
11835
- Loki: ID
11559
- Node Exporter Full: ID
- Alert rules in
monitoring/alertmanager.yml
- Email notifications via SMTP (Gmail or custom)
- Promtail ships logs from Docker containers
- Loki stores and indexes logs
- Explore logs in Grafana (
Explore
tab)
- If Email not sending.? Ensure your SMTP credentials are valid and App Passwords are enabled for Gmail if used.
- To add custom application metrics using
prom-client
- Set up Slack / Discord alert routing
- Configure recording rules for Prometheus
- Automate provisioning with Terraform/Ansible
- Create prebuilt Grafana dashboards with provisioning
- This project is based on the roadmap provided in the DevOps Roadmap Project