Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.6.0
vBot Central Server Setup Guide
Overview
This guide provides detailed instructions for setting up the central vBot server that handles call transcription and analysis. The central server is deployed on Hugging Face Space and manages customer accounts, API keys, and webhook delivery.
Prerequisites
- Hugging Face account
- MySQL database (version 5.7 or higher)
- Python 3.8 or higher
- Git
Step 1: Deploy to Hugging Face Space
Create a new Space:
- Go to https://huggingface.co/spaces
- Click "New Space"
- Choose "Gradio" as the SDK
- Set the Space name (e.g., "vBot")
- Set visibility (public/private)
Clone the repository:
git clone https://huggingface.co/spaces/iajitpanday/vBot cd vBotConfigure environment variables:
cp .env.example .env # Edit .env with your configurationRequired environment variables:
DATABASE_URL=mysql://user:password@host:port/database SECRET_KEY=your-secret-key API_BASE_URL=https://your-space.huggingface.spacePush to Hugging Face:
git add . git commit -m "Initial deployment" git push
Step 2: Database Setup
Create the database:
CREATE DATABASE vbot_central; USE vbot_central;Create required tables:
CREATE TABLE customers ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) NOT NULL, company_name VARCHAR(255), email VARCHAR(255) NOT NULL, api_key VARCHAR(64) NOT NULL UNIQUE, webhook_url VARCHAR(255), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP );
Step 3: Admin Setup
Access the admin interface:
- URL:
https://your-space.huggingface.space/admin - Default credentials: admin/admin
- URL:
Change admin password:
- Click "Change Password"
- Enter new secure password
- Save changes
Create first customer:
- Click "Add Customer"
- Fill in customer details
- System will generate API key
- Save customer information
Step 4: API Configuration
Verify API endpoints:
curl https://your-space.huggingface.space/healthTest customer API:
curl -X POST https://your-space.huggingface.space/api/process-call \ -H "X-API-Key: customer-api-key" \ -H "Content-Type: multipart/form-data" \ -F "file=@test.wav" \ -H "caller_number=+1234567890" \ -H "called_number=+0987654321"
Step 5: Security Setup
Configure SSL:
- Hugging Face Spaces provides SSL by default
- Verify SSL certificate is valid
API Security:
- All API endpoints require valid API key
- Implement rate limiting
- Validate input data
- Sanitize output data
Webhook Security:
- Require HTTPS for webhook URLs
- Validate webhook signatures
- Implement retry mechanism
- Log webhook delivery attempts
Step 6: Monitoring Setup
Log Configuration:
# Application logs tail -f logs/app.log # Error logs tail -f logs/error.log # Access logs tail -f logs/access.logHealth Monitoring:
- Set up health check endpoint
- Monitor API response times
- Track webhook delivery success
- Monitor database performance
Step 7: Maintenance
Regular Tasks:
- Monitor system logs
- Check API performance
- Verify webhook delivery
- Review security logs
Backup Strategy:
- Regular database backups
- Configuration backups
- Log rotation
- API key rotation
Update Process:
# Update code git pull # Update dependencies pip install -r requirements.txt # Restart application
Troubleshooting
Common Issues:
- API authentication failures
- Webhook delivery failures
- Database connection issues
- Performance problems
Debug Tools:
# Check application logs tail -f logs/app.log # Check error logs tail -f logs/error.log # Check database connection mysql -u user -p vbot_centralSupport:
- Check documentation
- Review logs
- Contact support
- Submit issues
Security Best Practices
API Security:
- Use strong API keys
- Implement rate limiting
- Validate all inputs
- Sanitize all outputs
Database Security:
- Use strong passwords
- Limit database access
- Regular backups
- Encryption at rest
Webhook Security:
- Require HTTPS
- Validate signatures
- Implement retries
- Monitor delivery
Performance Optimization
API Optimization:
- Implement caching
- Optimize database queries
- Use connection pooling
- Monitor response times
Webhook Optimization:
- Implement queue system
- Use async processing
- Monitor delivery times
- Handle failures gracefully
Database Optimization:
- Index frequently queried columns
- Optimize table structure
- Regular maintenance
- Monitor performance