PythonDockerPrometheusGrafanaNginxMySQL

Architecture

Five services running together via Docker Compose, each with a single responsibility. The Flask app exposes a /metrics endpoint that Prometheus scrapes on a schedule. Grafana connects to Prometheus as a data source and loads pre-provisioned dashboards automatically at startup. Nginx sits in front of Flask handling all external HTTP routing. MySQL provides persistent storage for application data.

No manual dashboard setup required — everything provisions itself from config files on first boot. One command brings the entire stack up.


Services
Flask
Web Application
REST API instrumented with Prometheus metrics. Exposes /metrics endpoint tracking HTTP request counts and latency per endpoint.
Prometheus
Metrics Collection
Scrapes the Flask /metrics endpoint on schedule. Stores time-series data and provides the PromQL query engine for Grafana.
Grafana
Visualization
Pre-provisioned dashboards showing total requests, requests per second, average response time, and breakdown by endpoint. No manual setup required.
Nginx
Reverse Proxy
Handles all external HTTP routing to the Flask application. Follows production patterns for service separation.
MySQL
Persistent Storage
Application data stored in a named Docker volume, persisting across container restarts and rebuilds.

Data Flow
External request
|
Nginx # reverse proxy
|
Flask App # handles request, increments counters
| |
MySQL Prometheus # scrapes /metrics
|
Grafana # visualizes metrics in real time

Key Features

Metrics Tracked
app_requests_total # total HTTP requests counter
rate(requests[1m]) # requests per second
avg(response_latency) # average response time
requests_by_endpoint # breakdown per route

Why I Built It

Observability is a core part of both DevOps and security operations. A SOC analyst who understands how metrics pipelines work — how Prometheus scrapes targets, how Grafana queries time-series data, how dashboards surface anomalies — is significantly more effective than one who just consumes dashboards without understanding what is underneath them.

Using Docker Compose to orchestrate all five services also reflects how modern infrastructure actually works. Understanding container networking, volume persistence, and service dependencies from first principles is more valuable than following a tutorial. Every configuration file in this project was written and understood, not copied.

This stack also demonstrates that my interests extend beyond pure security tooling into the infrastructure and observability layer that security operations depend on.