fix(stack): bring-up fixes from first local deployment
- traefik pin v3.3 -> v3.6: v3.3's old docker client fails against
Engine 29 socket proxy (empty daemon errors, no routers)
- backend/minio/chatbot/umami: traefik.docker.network hint — Traefik
picked the internal-network IP for multi-network services and replies
were hairpin-dropped (all backend routes hung)
- db-init: psql needs an explicit -d arameshplaza (no default db 'aramesh'),
set -e so failures actually fail; one-shot folded-YAML needs semicolons
- chatbot image: drop g++ (apt unreachable in build network; all wheels
prebuilt) and mkdir /data before chown (VOLUME does not create it)
- frontend image: create caddy user (alpine image has none) with writable
/config and /data
- monitoring: blackbox probes replace raw metric scrapes of JSON/HTML
health endpoints (they reported 'down' while healthy); blackbox joins
edge; SITE_URL passed via env (Prometheus has no ${VAR:-default}
expansion); ContainerMemoryNearLimit PromQL fixed (comparison inside
label braces); HostDiskAlmostFull filters WSL/Docker-Desktop
pseudo-mounts
- alertmanager: config rendered by stack.sh (no env expansion in AM) and
delivered to Bale (tapi.bale.ai); stack.sh monitoring command
- machine-local override: minio console/API moved to 29001/29000
This commit is contained in:
@@ -5,6 +5,7 @@ groups:
|
||||
- name: aramesh-availability
|
||||
rules:
|
||||
- alert: ServiceDown
|
||||
# سرویسهای دارای متریک (backend/traefik/exporters) — بقیه با ProbeFailing پوشش میشوند
|
||||
expr: up == 0
|
||||
for: 2m
|
||||
labels:
|
||||
@@ -13,6 +14,15 @@ groups:
|
||||
summary: "{{ $labels.job }} پاسخ نمیدهد"
|
||||
description: "سرویس {{ $labels.job }} ({{ $labels.instance }}) حداقل ۲ دقیقه پایین است."
|
||||
|
||||
- alert: ProbeFailing
|
||||
expr: probe_success == 0
|
||||
for: 2m
|
||||
labels:
|
||||
severity: critical
|
||||
annotations:
|
||||
summary: "پروب {{ $labels.job }} ناموفق است"
|
||||
description: "سرویسِ پشت پروب {{ $labels.instance }} حداقل ۲ دقیقه پاسخ نمیدهد."
|
||||
|
||||
- alert: BackendHealthFailing
|
||||
expr: probe_success{job="blackbox-internal-health"} == 0
|
||||
for: 2m
|
||||
@@ -34,8 +44,9 @@ groups:
|
||||
- name: aramesh-resources
|
||||
rules:
|
||||
- alert: HostDiskAlmostFull
|
||||
# Docker Desktop/WSL سوارهای تکراری میسازد — فقط مسیرهای واقعی دیده میشوند
|
||||
expr: |
|
||||
1 - (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay|squashfs"}) > 0.85
|
||||
1 - (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|squashfs", mountpoint!~"/run/desktop.*|/parent-distro.*|/usr/lib/wsl.*|/mnt/wsl.*"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay|squashfs", mountpoint!~"/run/desktop.*|/parent-distro.*|/usr/lib/wsl.*|/mnt/wsl.*"}) > 0.85
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
@@ -54,8 +65,9 @@ groups:
|
||||
|
||||
- alert: ContainerMemoryNearLimit
|
||||
expr: |
|
||||
container_memory_usage_bytes{image!="", container!="", container_spec_memory_limit_bytes > 0}
|
||||
/ container_spec_memory_limit_bytes{container!="", container_spec_memory_limit_bytes > 0} > 0.9
|
||||
(container_memory_usage_bytes{image!="", container!=""}
|
||||
/ container_spec_memory_limit_bytes{image!="", container!=""} > 0.9)
|
||||
and (container_spec_memory_limit_bytes{image!="", container!=""} > 0)
|
||||
for: 10m
|
||||
labels:
|
||||
severity: warning
|
||||
|
||||
@@ -39,26 +39,49 @@ scrape_configs:
|
||||
static_configs:
|
||||
- targets: ["postgres-exporter:9187"]
|
||||
|
||||
# سلامت مستقیم سرویسها — up == 0 یعنی آن سرویس پایین است
|
||||
- job_name: frontend
|
||||
metrics_path: /
|
||||
# سلامت سرویسهای بدون متریک — با پروب blackbox (پاسخ JSON/HTML قابل اسکرپ نیست)
|
||||
# نتیجه: probe_success (۱ = سالم، ۰ = پایین) — هشدار ProbeFailing پوشش میدهد
|
||||
- job_name: blackbox-frontend
|
||||
metrics_path: /probe
|
||||
params:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets: ["frontend:80"]
|
||||
- targets:
|
||||
- http://frontend/
|
||||
relabel_configs: &blackbox_relabel
|
||||
- source_labels: [__address__]
|
||||
target_label: __param_target
|
||||
- source_labels: [__param_target]
|
||||
target_label: instance
|
||||
- target_label: __address__
|
||||
replacement: blackbox-exporter:9115
|
||||
|
||||
- job_name: minio
|
||||
metrics_path: /minio/health/live
|
||||
- job_name: blackbox-minio
|
||||
metrics_path: /probe
|
||||
params:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets: ["minio:9000"]
|
||||
- targets:
|
||||
- http://minio:9000/minio/health/live
|
||||
relabel_configs: *blackbox_relabel
|
||||
|
||||
- job_name: umami
|
||||
metrics_path: /api/heartbeat
|
||||
- job_name: blackbox-umami
|
||||
metrics_path: /probe
|
||||
params:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets: ["umami:3000"]
|
||||
- targets:
|
||||
- http://umami:3000/api/heartbeat
|
||||
relabel_configs: *blackbox_relabel
|
||||
|
||||
- job_name: chatbot
|
||||
metrics_path: /chat/healthz
|
||||
- job_name: blackbox-chatbot
|
||||
metrics_path: /probe
|
||||
params:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets: ["chatbot:8000"]
|
||||
- targets:
|
||||
- http://chatbot:8000/chat/healthz
|
||||
relabel_configs: *blackbox_relabel
|
||||
|
||||
# پروب بیروننگر — سلامت واقعی /api/health (بخش عمق: DB و MinIO را میآزماید)
|
||||
# و در تولید، آدرس عمومی سایت (SITE_URL از .env — پشتیبانی متغیر محیطی Prometheus)
|
||||
@@ -69,13 +92,7 @@ scrape_configs:
|
||||
static_configs:
|
||||
- targets:
|
||||
- http://backend:8000/api/health
|
||||
relabel_configs: &blackbox_relabel
|
||||
- source_labels: [__address__]
|
||||
target_label: __param_target
|
||||
- source_labels: [__param_target]
|
||||
target_label: instance
|
||||
- target_label: __address__
|
||||
replacement: blackbox-exporter:9115
|
||||
relabel_configs: *blackbox_relabel
|
||||
|
||||
- job_name: blackbox-public
|
||||
metrics_path: /probe
|
||||
@@ -83,5 +100,7 @@ scrape_configs:
|
||||
module: [http_2xx]
|
||||
static_configs:
|
||||
- targets:
|
||||
- ${SITE_URL:-http://frontend/}
|
||||
# مقدار پیشفرض در docker-compose.monitoring.yml تنظیم میشود
|
||||
# (Prometheus سینتکس ${VAR:-default} را پشتیبانی نمیکند)
|
||||
- ${SITE_URL}
|
||||
relabel_configs: *blackbox_relabel
|
||||
|
||||
Reference in New Issue
Block a user