Security: deep /api/health (DB+MinIO probes, 503 on failure) + /api/live; rate-limited public forms with honeypots; real client IP behind Traefik (--proxy-headers); TipTap URL sanitization on write (nh3); non-root containers + slim .dockerignore; prod MinIO console bound to 127.0.0.1; HSTS/nosniff on TLS routers; JWT 8h; no default credentials in code. Reliability: Alembic migrations (create_all baseline); graceful shutdown (exec uvicorn); hardened backups (checksums, sanity check, freshness gauge, optional rclone off-site) + restore.sh + hourly db-backup sidecar (ops profile); stack.sh ops tooling (deploy/logs/health/backup/restore/monitoring); .gitattributes LF for shell scripts. Orchestration: json-file log rotation, pinned images, per-service memory limits, edge/internal networks, Traefik ping/accesslog/metrics + flood limiter, conditional minio-setup, pgvector db image, one-shot db-init (umami + aramesh_chatbot databases). Chatbot: unified from site-chatbot branch (RAG + pgvector, SSE, ChatWidget). Monitoring: Prometheus/Alertmanager/Loki/Promtail/Grafana + cAdvisor, node/postgres/blackbox exporters, provisioned dashboards and 10 alert rules; alerts delivered to Bale (tapi.bale.ai — Telegram-compatible). Analytics: Umami on shared Postgres, build-time tracker injection, custom events (contact/newsletter/phone/chat/lang) via frontend/src/analytics.ts. Hygiene: CSV export for contact messages and subscribers; upload image optimization (Pillow); CI script + GitHub-compatible workflow; audit.sh; gen-env.sh for strong credentials.
29 lines
1.4 KiB
Bash
29 lines
1.4 KiB
Bash
# سرویس چتبات — این مقادیر را در .env ریشه پروژه بگذارید (نه اینجا)
|
|
# این فایل فقط مستندسازی متغیرهاست.
|
|
|
|
# --- اجباری ---
|
|
# دیتابیس سایت (فقط خواندن) — در داکر از docker-compose.yml تزریق میشود
|
|
# DATABASE_URL=postgresql+psycopg://aramesh:PASSWORD@db:5432/arameshplaza
|
|
|
|
# LLM سازگار با OpenAI — بدون این چتبات پاسخ نمیدهد
|
|
# مثال سرور داخلی: LLM_BASE_URL=http://172.16.22.21:4460/v1
|
|
# مثال سرویس ابری: LLM_BASE_URL=https://api.example.com/v1
|
|
LLM_BASE_URL=
|
|
LLM_API_KEY=
|
|
LLM_MODEL=openai/gpt-oss-120b
|
|
|
|
# --- اختیاری ---
|
|
# توکن محافظت از POST /chat/reindex — اگر خالی باشد مسیر ۴۰۳ میدهد
|
|
CHAT_REINDEX_TOKEN=
|
|
# ریرنکر را روی سرور کمرم خاموش کنید (RERANKER_ENABLED=false)
|
|
RERANKER_ENABLED=true
|
|
# وزن جستوجوی معنایی در ترکیب نمرهها (۰ تا ۱) — پیشفرض ۰.۵
|
|
ALPHA_DENSE=0.5
|
|
# تعداد سند نهایی به LLM — پیشفرض ۳
|
|
BEST_OF_K=3
|
|
# بازسازی خودکار ایندکس پس از تغییر محتوا (ثانیه، ۰ = خاموش)
|
|
INDEX_REFRESH_SECONDS=600
|
|
# محدودیت نرخ: حداکثر پیام در پنجره زمانی (پیشفرض ۲۰ پیام در ۳۰۰ ثانیه)
|
|
RATE_LIMIT_MESSAGES=20
|
|
RATE_LIMIT_WINDOW=300
|