Implement a comprehensive web-based dashboard for managing Telegram and Discord bots with real-time monitoring, process control, and beautiful UI. Backend (FastAPI): - Complete REST API with OpenAPI documentation - WebSocket support for real-time log streaming and statistics - SQLAlchemy models for bots, logs, and users - JWT-based authentication system - Process management with subprocess and psutil - Auto-restart functionality with configurable backoff - System and bot resource monitoring (CPU, RAM, network) - Comprehensive error handling and logging Frontend (Next.js 14 + TypeScript): - Modern React application with App Router - shadcn/ui components with Tailwind CSS - TanStack Query for data fetching and caching - Real-time WebSocket integration - Responsive design for mobile, tablet, and desktop - Beautiful dark theme with glassmorphism effects - Bot cards with status badges and controls - System statistics dashboard Example Bots: - Telegram userbot using Telethon - Telegram bot using python-telegram-bot - Discord bot using discord.py - Full command examples and error handling Infrastructure: - Docker and Docker Compose configurations - Multi-stage builds for optimal image sizes - Nginx reverse proxy with WebSocket support - Production and development compose files - Rate limiting and security headers Documentation: - Comprehensive README with setup instructions - API documentation examples - Configuration guides - Troubleshooting section - Makefile for common commands Features: - Start/stop/restart bots with one click - Real-time log streaming via WebSocket - Live system and bot statistics - Auto-restart on crashes - Bot configuration management - Process monitoring and resource tracking - Search and filter bots - Responsive UI with loading states - Toast notifications for all actions Security: - JWT token-based authentication - Password hashing with bcrypt - CORS configuration - Environment variable management - Input validation and sanitization - Rate limiting in nginx - Security headers configured
62 lines
1.4 KiB
YAML
62 lines
1.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: bot-dashboard-backend
|
|
volumes:
|
|
- ./bots:/app/bots
|
|
- bot-data:/app/data
|
|
environment:
|
|
- DATABASE_URL=sqlite:///./data/bot_dashboard.db
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
- CORS_ORIGINS=${CORS_ORIGINS:-https://yourdomain.com}
|
|
- LOG_LEVEL=INFO
|
|
- AUTO_RESTART_BOTS=true
|
|
restart: always
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: bot-dashboard-frontend
|
|
environment:
|
|
- NEXT_PUBLIC_API_URL=${API_URL:-https://yourdomain.com}
|
|
- NEXT_PUBLIC_WS_URL=${WS_URL:-wss://yourdomain.com}
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
restart: always
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: bot-dashboard-nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./nginx/ssl:/etc/nginx/ssl:ro
|
|
- nginx-cache:/var/cache/nginx
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
restart: always
|
|
|
|
volumes:
|
|
bot-data:
|
|
driver: local
|
|
nginx-cache:
|
|
driver: local
|
|
|
|
networks:
|
|
default:
|
|
name: bot-dashboard-network
|