feat: Ajout monitoring Prometheus/Grafana et configuration déploiement serveur Linux
- Ajout Prometheus et Grafana au docker-compose.yml - Métriques automatiques pour le backend FastAPI - Configuration de production avec docker-compose.prod.yml - Guide de déploiement manuel pour serveur Linux - Variables d'environnement sécurisées - Documentation complète de déploiement
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Dockezr - Vue d'ensemble",
|
||||
"tags": ["dockezr", "monitoring"],
|
||||
"style": "dark",
|
||||
"timezone": "browser",
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "État des services",
|
||||
"type": "stat",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "up{job=\"dockezr-backend\"}",
|
||||
"legendFormat": "Backend FastAPI"
|
||||
},
|
||||
{
|
||||
"expr": "up{job=\"dockezr-frontend\"}",
|
||||
"legendFormat": "Frontend Next.js"
|
||||
},
|
||||
{
|
||||
"expr": "up{job=\"dockezr-database\"}",
|
||||
"legendFormat": "Base de données"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"thresholds": {
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Requêtes par seconde - Backend",
|
||||
"type": "graph",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "rate(http_requests_total{job=\"dockezr-backend\"}[5m])",
|
||||
"legendFormat": "RPS"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Temps de réponse - Backend",
|
||||
"type": "graph",
|
||||
"targets": [
|
||||
{
|
||||
"expr": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket{job=\"dockezr-backend\"}[5m]))",
|
||||
"legendFormat": "95th percentile"
|
||||
},
|
||||
{
|
||||
"expr": "histogram_quantile(0.50, rate(http_request_duration_seconds_bucket{job=\"dockezr-backend\"}[5m]))",
|
||||
"legendFormat": "50th percentile"
|
||||
}
|
||||
],
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
}
|
||||
}
|
||||
],
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"refresh": "30s"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: 'default'
|
||||
orgId: 1
|
||||
folder: ''
|
||||
type: file
|
||||
disableDeletion: false
|
||||
updateIntervalSeconds: 10
|
||||
allowUiUpdates: true
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
editable: true
|
||||
@@ -0,0 +1,39 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
rule_files:
|
||||
# - "first_rules.yml"
|
||||
# - "second_rules.yml"
|
||||
|
||||
scrape_configs:
|
||||
# Prometheus lui-même
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
# Backend FastAPI avec métriques
|
||||
- job_name: 'dockezr-backend'
|
||||
static_configs:
|
||||
- targets: ['backend:8000']
|
||||
metrics_path: '/metrics'
|
||||
scrape_interval: 10s
|
||||
scrape_timeout: 5s
|
||||
|
||||
# Base de données PostgreSQL (via postgres_exporter si ajouté)
|
||||
- job_name: 'dockezr-database'
|
||||
static_configs:
|
||||
- targets: ['db:5432']
|
||||
scrape_interval: 30s
|
||||
|
||||
# Frontend Next.js (métriques de base)
|
||||
- job_name: 'dockezr-frontend'
|
||||
static_configs:
|
||||
- targets: ['frontend:3000']
|
||||
scrape_interval: 30s
|
||||
|
||||
# Node Exporter pour métriques système (optionnel)
|
||||
- job_name: 'node-exporter'
|
||||
static_configs:
|
||||
- targets: ['node-exporter:9100']
|
||||
scrape_interval: 15s
|
||||
Reference in New Issue
Block a user