Implement AnonBot integration and monitoring enhancements

- Added AnonBot service to docker-compose with resource limits and environment variables.
- Updated Makefile to include commands for AnonBot logs, restart, and dependency checks.
- Enhanced Grafana dashboards with AnonBot health metrics and database connection statistics.
- Implemented AnonBot status retrieval in the message sender for improved monitoring.
- Updated Prometheus configuration to scrape metrics from AnonBot service.
This commit was merged in pull request #2.
This commit is contained in:
2025-09-08 23:17:24 +03:00
parent 40968dd075
commit b34da5015d
9 changed files with 2187 additions and 206 deletions

View File

@@ -130,11 +130,64 @@ services:
deploy:
resources:
limits:
memory: 512M
memory: 256M
cpus: '0.5'
reservations:
memory: 128M
cpus: '0.25'
# AnonBot - Anonymous Q&A Bot
anon-bot:
build:
context: ./bots/AnonBot
dockerfile: Dockerfile
container_name: bots_anon_bot
restart: unless-stopped
env_file:
- ./bots/AnonBot/.env
ports:
- "8081:8081"
environment:
- PYTHONPATH=/app
- PYTHONUNBUFFERED=1
- DOCKER_CONTAINER=true
- LOG_LEVEL=${LOG_LEVEL:-INFO}
# AnonBot settings
- ANON_BOT_TOKEN=${BOT_TOKEN}
- ANON_BOT_ADMINS=${ADMINS}
- ANON_BOT_DATABASE_PATH=/app/database/anon_qna.db
- ANON_BOT_DEBUG=${DEBUG:-false}
- ANON_BOT_MAX_QUESTION_LENGTH=${MAX_QUESTION_LENGTH:-1000}
- ANON_BOT_MAX_ANSWER_LENGTH=${MAX_ANSWER_LENGTH:-2000}
# Rate limiting settings
- RATE_LIMIT_ENV=${RATE_LIMIT_ENV:-production}
- RATE_LIMIT_MESSAGES_PER_SECOND=${RATE_LIMIT_MESSAGES_PER_SECOND:-0.5}
- RATE_LIMIT_BURST_LIMIT=${RATE_LIMIT_BURST_LIMIT:-2}
- RATE_LIMIT_RETRY_MULTIPLIER=${RATE_LIMIT_RETRY_MULTIPLIER:-1.5}
- RATE_LIMIT_MAX_RETRY_DELAY=${RATE_LIMIT_MAX_RETRY_DELAY:-30.0}
- RATE_LIMIT_MAX_RETRIES=${RATE_LIMIT_MAX_RETRIES:-3}
volumes:
- ./bots/AnonBot/database:/app/database:rw
- ./bots/AnonBot/logs:/app/logs:rw
- ./bots/AnonBot/.env:/app/.env:ro
networks:
- bots_network
depends_on:
- prometheus
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
memory: 256M
cpus: '0.25'
reservations:
memory: 128M
cpus: '0.1'
volumes:
prometheus_data: