# ruanbekker/docker-monitoring-stack-gpnc architecture

> Architecture diagram of the GitHub repository ruanbekker/docker-monitoring-stack-gpnc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ruanbekker/docker-monitoring-stack-gpnc
- Repository: https://github.com/ruanbekker/docker-monitoring-stack-gpnc

## Overview

##### Project Type and Purpose
- This is a Docker-Compose-based, full-stack monitoring solution.
- Purpose: collect host/container metrics, scrape and store time-series data, aggregate logs, provide dashboards, and handle alerts.

##### File Structure
- Top level:
- `docker-compose.yml` defines orchestration of containers.
- `configs/` holds per-service configuration.
- `dashboards/` contains Grafana dashboard JSON files.
- No traditional “frontend/backend” folders—each service is its own container microservice.

##### README for Insights
- Lists the seven components:
- Grafana (dashboard UI)
- Prometheus (metrics TSDB + scraper)
- Node-Exporter & cAdvisor (metrics sources)
- Alertmanager (alerting engine)
- Uncomplicated Alert Receiver (alert-view UI)
- Loki + Promtail (log ingestion & storage)

##### Main Components & Their Roles
a. Infrastructure Layer
- Docker Host running Docker Compose
b. Metrics Collection
- Node Exporter → exposes host metrics
- cAdvisor → exposes container metrics
c. Metrics Storage & Processing
- Prometheus → pulls from Node Exporter & cAdvisor, stores time-series, evaluates rules
d. Alerting
- Alertmanager → receives alerts from Prometheus
- Uncomplicated Alert Receiver → UI for Alertmanager
e. Logging
- Promtail → agent reading container logs, pushing to Loki
- Loki → log aggregation and storage
f. Visualization
- Grafana → reads dashboards from JSON, connects to Prometheus and Loki

##### Relationships & Data Flows
- Node Exporter & cAdvisor “→” Prometheus (scrape over HTTP)
- Prometheus “→” Alertmanager (push alerts when rules fire)
- Alertmanager “→” Uncomplicated Alert Receiver (for UI viewing)
- Promtail “→” Loki (push log streams)
- Grafana “↔” Prometheus (query metrics)
- Grafana “↔” Loki (query logs)

##### Architectural Patterns & Principles
- Container-based microservices, each single-purpose
- Separation of concerns: metrics vs logs vs alerting vs visualization
- Declarative provisioning: configs/ folder for each service
- Immutable infrastructure: spin up via Docker Compose

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Docker Host / Docker Compose"
        DC["Docker Compose"]:::infrastructure
        subgraph "Metrics Collection"
            NE["Node Exporter:9100"]:::metrics
            CA["cAdvisor:8080"]:::metrics
        end
        subgraph "Metrics Storage & Processing"
            PR["Prometheus:9090"]:::processing
            PCfg["Prometheus Config"]:::config
            ARules["Alerting Rules"]:::config
            RRules["Recording Rules"]:::config
        end
        subgraph "Alerting"
            AM["Alertmanager:9093"]:::alerting
            AMCfgEmail["Email Receiver Config"]:::config
            AMCfgFallback["Fallback Receiver Config"]:::config
            AMCfgOps["OpsGenie Receiver Config"]:::config
            AMCfgPush["Pushover Receiver Config"]:::config
            AMCfgSlack["Slack Receiver Config"]:::config
            UAR["Uncomplicated Alert Receiver:8081"]:::viz
        end
        subgraph "Logging"
            PT["Promtail"]:::logging
            PTCfg["Promtail Config"]:::config
            LO["Loki"]:::logging
            LOCfg["Loki Config"]:::config
            LORules["Loki Rules"]:::config
        end
        subgraph "Visualization"
            GF["Grafana:3000"]:::viz
            GFCfgDash["Dashboards Provisioning"]:::config
            GFCfgData["Datasources Provisioning"]:::config
            DB1["container-metrics.json"]:::config
            DB2["node-metrics.json"]:::config
            DB3["log-search.json"]:::config
        end
    end

    NE -->|"HTTP scrape"| PR
    CA -->|"HTTP scrape"| PR
    PR -->|"Alert push"| AM
    AM -->|"UI access"| UAR
    PT -->|"Log push"| LO
    GF -->|"query metrics"| PR
    GF -->|"query logs"| LO

    PCfg --> PR
    ARules --> PR
    RRules --> PR

    AMCfgEmail --> AM
    AMCfgFallback --> AM
    AMCfgOps --> AM
    AMCfgPush --> AM
    AMCfgSlack --> AM

    PTCfg --> PT
    LOCfg --> LO
    LORules --> LO

    GFCfgDash --> GF
    GFCfgData --> GF
    DB1 --> GF
    DB2 --> GF
    DB3 --> GF

    click DC "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/docker-compose.yml"
    click GFCfgDash "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/grafana/provisioning/dashboards.yml"
    click GFCfgData "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/grafana/provisioning/datasources.yml"
    click DB1 "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/dashboards/container-metrics.json"
    click DB2 "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/dashboards/node-metrics.json"
    click DB3 "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/dashboards/log-search.json"
    click PCfg "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/prometheus/prometheus.yml"
    click ARules "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/prometheus/alerting-rules.yml"
    click RRules "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/prometheus/recording-rules.yml"
    click AMCfgEmail "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/alertmanager/alertmanager-email-config.yml"
    click AMCfgFallback "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/alertmanager/alertmanager-fallback-config.yml"
    click AMCfgOps "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/alertmanager/alertmanager-opsgenie-config.yml"
    click AMCfgPush "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/alertmanager/alertmanager-pushover-config.yml"
    click AMCfgSlack "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/alertmanager/alertmanager-slack-config.yml"
    click LOCfg "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/loki/loki.yaml"
    click LORules "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/loki/rules.yaml"
    click PTCfg "https://github.com/ruanbekker/docker-monitoring-stack-gpnc/blob/main/configs/promtail/promtail.yaml"

    classDef infrastructure fill:#e0f7fa,stroke:#006064,color:#006064;
    classDef metrics fill:#bbdefb,stroke:#0d47a1,color:#0d47a1;
    classDef processing fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20;
    classDef alerting fill:#ffe0b2,stroke:#e65100,color:#e65100;
    classDef logging fill:#e1bee7,stroke:#4a148c,color:#4a148c;
    classDef viz fill:#fff9c4,stroke:#f57f17,color:#f57f17;
    classDef config fill:#eceff1,stroke:#455a64,color:#455a64;
```
