- Multi-stage Dockerfile (builder+runner, <500MB target) - docker-compose.yml: app(x4) + postgres + redis + prometheus + grafana + nginx - .env.example with all required secrets (never hardcoded) - requirements.txt with all dependencies including prometheus-client, alembic - GitHub Actions CI: lint (flake8+bandit+safety) + tests + Docker build/push - GitHub Actions CD: staging deploy -> smoke tests -> production deploy + rollback - Alembic migration setup + initial PostgreSQL schema (001_initial_schema) - SQLite→PostgreSQL data migration script - Prometheus metrics module (HTTP, ML, DB, business metrics) - Prometheus alert rules (5xx >1%, latency >2s, disk >80%, ML accuracy) - Grafana dashboard (overview: req/s, p95, ML accuracy, error rate) - Nginx reverse proxy config (HTTPS/TLS, rate limiting, security headers) - Structured JSON logging module - Automated daily DB backup script (pg_dump + 30-day retention) Branch: feature/devops-cicd Co-Authored-By: Paperclip <noreply@paperclip.ing>
69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
# ============================================================
|
|
# Prometheus Configuration — Turf SaaS
|
|
# ============================================================
|
|
|
|
global:
|
|
scrape_interval: 15s
|
|
evaluation_interval: 15s
|
|
external_labels:
|
|
project: turf-saas
|
|
env: production
|
|
|
|
# Alertmanager — wire up when available
|
|
alerting:
|
|
alertmanagers:
|
|
- static_configs:
|
|
- targets: []
|
|
|
|
# Load alert rules
|
|
rule_files:
|
|
- "alerts.yml"
|
|
|
|
# ============================================================
|
|
# Scrape targets
|
|
# ============================================================
|
|
scrape_configs:
|
|
# Prometheus self-monitoring
|
|
- job_name: prometheus
|
|
static_configs:
|
|
- targets: [localhost:9090]
|
|
|
|
# Combined API
|
|
- job_name: combined-api
|
|
static_configs:
|
|
- targets: [combined-api:8790]
|
|
metrics_path: /metrics
|
|
scrape_interval: 15s
|
|
|
|
# Dashboard API
|
|
- job_name: dashboard-api
|
|
static_configs:
|
|
- targets: [dashboard-api:8791]
|
|
metrics_path: /metrics
|
|
scrape_interval: 15s
|
|
|
|
# Portal
|
|
- job_name: portal
|
|
static_configs:
|
|
- targets: [portal:8792]
|
|
metrics_path: /metrics
|
|
scrape_interval: 30s
|
|
|
|
# PostgreSQL exporter (if deployed)
|
|
- job_name: postgres
|
|
static_configs:
|
|
- targets: [postgres-exporter:9187]
|
|
scrape_interval: 30s
|
|
|
|
# Redis exporter (if deployed)
|
|
- job_name: redis
|
|
static_configs:
|
|
- targets: [redis-exporter:9121]
|
|
scrape_interval: 30s
|
|
|
|
# Node exporter (host metrics)
|
|
- job_name: node
|
|
static_configs:
|
|
- targets: [host.docker.internal:9100]
|
|
scrape_interval: 30s
|