new-site/infra/ansible/playbooks/site.yml
justin a4a5500bfc Add Prometheus + Grafana + Alertmanager monitoring stack
Full observability stack with Telegram alerting:

Components:
- Prometheus: metrics collection, 90-day retention
- Grafana: dashboards at monitoring.performancewest.net
- Alertmanager: routes alerts to Telegram bot
- node-exporter: OS metrics (CPU, RAM, disk, network)
- cAdvisor: container metrics (CPU, memory, restarts)
- postgres-exporter: PostgreSQL connection/query metrics
- nginx-exporter: request rate, 5xx errors, connections
- blackbox-exporter: HTTP/TCP endpoint probing + SSL cert checks

Alert rules:
- Service down (HTTP probe, TCP port, container missing)
- Container restart loops
- High CPU/memory/disk/load
- PostgreSQL down or high connections
- SSL cert expiring (14d warning, 3d critical)
- Slow HTTP responses, high 5xx rate

Blackbox probes all public endpoints:
  performancewest.net, api, dev, crm, lists, analytics,
  minio, crypto, pay

Telegram alerts: critical=1h repeat, warning=6h repeat,
  auto-resolve notifications

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-01 02:08:39 -05:00

36 lines
1.1 KiB
YAML

---
# Performance West — Full Stack Provisioning
# Provisions a fresh Debian 13 server from scratch.
#
# Usage:
# ansible-playbook playbooks/site.yml -i inventory/hosts.yml --ask-vault-pass
#
# Roles run in order:
# common — packages, deploy user, SSH hardening, UFW
# docker — Docker CE + compose plugin + performancewest.service systemd unit
# postgresql — API PostgreSQL + backup cron + migrations
# app — Express API container
# site — Astro static site container
# erpnext — ERPNext CRM + workers + scheduler (custom image with frappe_crypto + frappe_adyen)
# minio — MinIO object storage + bucket creation
# workers — Python job server + Ollama LLM
# shkeeper — k3s + Helm + SHKeeper (crypto payments: BTC/ETH/USDC/Polygon/TRX/BNB/LTC)
# nginx — nginx + certbot TLS for all domains + fail2ban
- name: Provision Performance West server
hosts: pw
become: true
roles:
- common
- docker
- postgresql
- app
- site
- erpnext
- minio
- workers
- worker-crons
- shkeeper
- nginx
- monitoring
- security-updates