Files
Fast-Whisper-MCP-Server/nginx
Alihan 3c0f79645c Clean up documentation and refine production optimizations
- Remove CLAUDE.md and IMPLEMENTATION_PLAN.md (development artifacts)
- Add nginx configuration for reverse proxy setup
- Update .gitignore for better coverage
- Refine GPU reset logic and error handling
- Improve job queue concurrency and resource management
- Enhance model manager retry logic and file locking
- Optimize transcriber batch processing and GPU allocation
- Strengthen API server input validation and monitoring
- Update circuit breaker with better timeout handling
- Adjust supervisor configuration for production stability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 01:25:01 +03:00
..

Nginx Configuration for Transcriptor API

This directory contains nginx reverse proxy configuration to fix 504 Gateway Timeout errors.

Problem

The transcriptor API can take a long time (10+ minutes) to process large audio files with the large-v3 model. Without proper timeout configuration, requests will fail with 504 Gateway Timeout.

Solution

The provided transcriptor.conf file configures nginx with appropriate timeouts:

  • proxy_connect_timeout: 600s (10 minutes)
  • proxy_send_timeout: 600s (10 minutes)
  • proxy_read_timeout: 3600s (1 hour)
  • client_max_body_size: 500M (for large audio files)

Installation

Option 1: Deploy nginx configuration (if using nginx)

# Copy configuration to nginx
sudo cp transcriptor.conf /etc/nginx/sites-available/

# Create symlink to enable it
sudo ln -s /etc/nginx/sites-available/transcriptor.conf /etc/nginx/sites-enabled/

# Test configuration
sudo nginx -t

# Reload nginx
sudo systemctl reload nginx

Option 2: Run API server directly (current setup)

The API server at src/servers/api_server.py has been updated with:

  • timeout_keep_alive=3600 (1 hour)
  • timeout_graceful_shutdown=60

No additional nginx configuration is needed if you're running the API directly.

Restart Service

After making changes, restart the transcriptor service:

# If using supervisor
sudo supervisorctl restart transcriptor-api

# If using systemd
sudo systemctl restart transcriptor-api

# If using docker
docker restart <container-name>

Testing

Test the API is working:

# Health check (should return 200)
curl http://192.168.1.210:33767/health

# Check timeout configuration
curl -X POST http://192.168.1.210:33767/transcribe \
  -F "file=@test_audio.mp3" \
  -F "model=large-v3" \
  -F "output_format=txt"

Monitoring

Check logs for timeout warnings:

# Supervisor logs
tail -f /home/uad/agents/tools/mcp-transcriptor/logs/transcriptor-api.log

# Look for messages like:
# - "Job {job_id} is taking longer than expected: 610.5s elapsed (threshold: 600s)"
# - "Job {job_id} exceeded maximum timeout: 3610.2s elapsed (max: 3600s)"

Configuration Environment Variables

You can also configure timeouts via environment variables in supervisor/transcriptor-api.conf:

environment=
    ...
    JOB_TIMEOUT_WARNING_SECONDS="600",    # Warn after 10 minutes
    JOB_TIMEOUT_MAX_SECONDS="3600",       # Fail after 1 hour

Troubleshooting

Still getting 504 errors?

  1. Check service is running:

    sudo supervisorctl status transcriptor-api
    
  2. Check port is listening:

    sudo netstat -tlnp | grep 33767
    
  3. Check logs for errors:

    tail -100 /home/uad/agents/tools/mcp-transcriptor/logs/transcriptor-api.log
    
  4. Test direct connection (bypass nginx):

    curl http://localhost:33767/health
    
  5. Verify GPU is working:

    curl http://192.168.1.210:33767/health/gpu
    

Job takes too long?

Consider:

  • Using a smaller model (e.g., medium instead of large-v3)
  • Splitting large audio files into smaller chunks
  • Increasing JOB_TIMEOUT_MAX_SECONDS for very long audio files