Server Dashboard
A Flask-based web dashboard for managing local server services with ComfyUI integration and Telegram bot support for automated image-to-video generation.
Features
- ๐๏ธ Service Management: Control systemd services (Ollama, ComfyUI, Sunshine) and Docker containers
- ๐ System Monitoring: Real-time CPU, memory, disk, and GPU stats
- ๐ฅ Image-to-Video Pipeline: Background job queue with ComfyUI orchestration
- ๐ค Telegram Bot: Send images and prompts via Telegram, receive videos back
- ๐ Local Network Security: Built-in access control for local network use
- โ๏ธ Web Configuration: Configure services through the web UI
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Flask Dashboard (Port 5000) โ
โ โ
โ - Service Control โ
โ - System Monitoring โ
โ - Job Queue Management โ
โ - Telegram Bot Integration โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Background Job Worker โ
โ โ
โ - Processes image-to-video jobs โ
โ - Communicates with ComfyUI โ
โ - Sends Telegram notifications โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ComfyUI Backend โ
โ โ
โ - AI/ML video generation โ
โ - Custom workflow execution โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Quick Start
Prerequisites
- Python 3.10+
- ComfyUI installed and running
- systemd-based Linux system
- Docker (optional, for open-webui)
- Telegram account (optional)
Installation
Clone the repository:
git clone https://github.com/yourusername/server-dashboard.git
cd server-dashboard
Create virtual environment:
python3 -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Configure environment:
cp server-dashboard.env.template /etc/server-dashboard.env
sudo nano /etc/server-dashboard.env
Set up directories:
mkdir -p data Workflows
Run the dashboard:
python app.py
Access the dashboard:
http://localhost:5000
Configuration
Environment Variables
Edit /etc/server-dashboard.env:
# Flask Configuration
DASHBOARD_BIND=0.0.0.0
DASHBOARD_PORT=5000
# ComfyUI Configuration
COMFYUI_BASE_URL=http://127.0.0.1:8188
# Storage
STORAGE_ROOT=./data
WORKFLOW_PATH=./Workflows/image_to_video_base.json
# Telegram (optional)
TELEGRAM_ENABLED=false
TELEGRAM_BOT_TOKEN=your_token_here
TELEGRAM_BOT_NAME=@YourBotName
TELEGRAM_DEFAULT_CHAT_ID=
# Public URL for webhooks (optional)
PUBLIC_BASE_URL=
ComfyUI Workflow
The dashboard requires a ComfyUI workflow in API format:
- Create your workflow in ComfyUI
- Export using "Save (API Format)"
- Save to
./Workflows/image_to_video_base.json
Your workflow must include:
- LoadImage node for input
- CLIPTextEncode node for prompts
- Video output node (e.g., VHS_VideoCombine)
Telegram Bot Setup
See README-telegram.md for detailed Telegram configuration.
Quick setup:
- Get bot token from @BotFather
- Add to environment configuration
- Enable via dashboard or set
TELEGRAM_ENABLED=true
Usage
Web Dashboard
Access at http://localhost:5000:
- Service Control: Start/stop/restart services
- System Stats: Monitor CPU, memory, GPU usage
- Job Management: View active and completed jobs
- Configuration: Set up Telegram and ComfyUI
API Endpoints
Job Management
# Create image-to-video job
POST /api/jobs/image-to-video
{
"prompt": "A beautiful sunset",
"input_image_url": "http://example.com/image.jpg",
"params": {
"seed": 42,
"duration_seconds": 2,
"fps": 8,
"resolution": "512x512"
}
}
# Get job status
GET /api/jobs/{job_id}
# Download result
GET /api/jobs/{job_id}/result
# Cancel job
POST /api/jobs/{job_id}/cancel
Service Control
# Control systemd services
POST /api/service/{service}/{action}
# service: ollama, comfyui, sunshine
# action: start, stop, restart
# Control Docker containers
POST /api/docker/{container}/{action}
# container: open-webui
# action: start, stop, restart
System Status
# Get all service statuses
GET /api/status
# Get admin panel status
GET /api/admin/status
Telegram Bot
Once configured, send messages to your bot:
/im2vid <prompt>
Then upload an image. The bot will:
- Queue the job
- Process via ComfyUI
- Send you the generated video
Security
โ ๏ธ IMPORTANT: This dashboard is designed for local network use only.
- Built-in access control limits requests to local IPs
- Never expose directly to the internet without additional authentication
- Use VPN for remote access
- See SECURITY.md for detailed security guidelines
Key Security Practices
- Never commit
.env files with real credentials
- Use environment variables for all sensitive data
- Protect environment files:
sudo chmod 600 /etc/server-dashboard.env
- Limit sudo permissions to specific commands only
- Keep dependencies updated
Development
Project Structure
server-dashboard/
โโโ app.py # Main Flask application
โโโ requirements.txt # Python dependencies
โโโ server-dashboard.env.template # Environment template
โโโ comfy/ # ComfyUI client modules
โ โโโ client.py
โ โโโ workflow.py
โโโ jobs/ # Job queue system
โ โโโ models.py
โ โโโ queue.py
โ โโโ store.py
โ โโโ worker.py
โโโ telegram/ # Telegram bot integration
โ โโโ api.py
โ โโโ poller.py
โ โโโ webhook.py
โโโ templates/ # HTML templates
โ โโโ index.html
โ โโโ config.html
โโโ static/ # CSS, JS, images
โโโ data/ # Job storage (gitignored)
โโโ Workflows/ # ComfyUI workflows (gitignored)
Running Tests
# TODO: Add test suite
python -m pytest tests/
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Troubleshooting
Dashboard won't start
# Check if port is in use
sudo lsof -i :5000
# Check environment file
cat /etc/server-dashboard.env
# Check logs
sudo journalctl -u server-dashboard
ComfyUI not reachable
# Verify ComfyUI is running
curl http://127.0.0.1:8188/system_stats
# Check URL in environment
grep COMFYUI_BASE_URL /etc/server-dashboard.env
Jobs failing
# Check worker logs in dashboard
# Verify workflow file exists
ls -la Workflows/image_to_video_base.json
# Test ComfyUI workflow manually
Telegram not working
# Test bot token
curl https://api.telegram.org/bot<TOKEN>/getMe
# Check webhook status
curl https://api.telegram.org/bot<TOKEN>/getWebhookInfo
# Enable debug logging in poller.py
Documentation
License
MIT License - See LICENSE file for details
Acknowledgments
- Built with Flask
- ComfyUI integration via REST API
- Telegram Bot API
- System monitoring with psutil
Support
For issues and questions:
- Open an issue on GitHub
- Check existing documentation
- Review logs for error messages