Skip to main content

Vast.ai Deployment Improvements (February 2026)

This document describes the comprehensive improvements made to Vast.ai deployment for GPU-accelerated streaming and duel hosting.

Overview

The Vast.ai deployment has been significantly enhanced with better reliability, audio capture, database persistence, and diagnostic capabilities. These changes ensure stable 24/7 streaming with automatic recovery.

Major Improvements

1. PulseAudio Audio Capture

What: Capture game audio (music and sound effects) for streaming. Implementation:
  • User-mode PulseAudio (more reliable than system mode)
  • Virtual sink (chrome_audio) for audio routing
  • Automatic fallback to silent audio if PulseAudio fails
  • XDG runtime directory at /tmp/pulse-runtime
Configuration:
See: docs/streaming-audio-capture.md

2. DATABASE_URL Persistence

Problem: DATABASE_URL was lost during git reset operations in deployment. Solution: Write secrets to /tmp before git reset, restore after:
Impact: Database connection survives deployment updates.

3. Database Warmup

Problem: Cold start issues with PostgreSQL connection pool. Solution: Warmup step after schema push with 3 retry attempts:
Impact: Eliminates cold start connection failures.

4. Stream Key Management

Problem: Stale stream keys in environment overrode correct values from secrets. Solution: Explicit unset and re-export before PM2 start:
Impact: Correct stream keys always used, no more wrong-platform streaming.

5. YouTube Removal

What: YouTube streaming explicitly disabled from default destinations. Why: Focusing on Twitch, Kick, and X for lower latency and better live betting experience. Implementation:
To re-enable:

6. Streaming Diagnostics

What: Comprehensive diagnostic output after deployment. Includes:
  • Streaming API state
  • Game client status (port 3333)
  • RTMP status file
  • FFmpeg processes
  • PM2 logs (filtered for streaming keywords)
Example Output:
Impact: Faster troubleshooting of streaming issues.

7. Solana Keypair Setup

What: Automated Solana keypair configuration from environment variable. Implementation:
Output: Keypair written to ~/.config/solana/id.json Impact: Keeper bot and Anchor tools work without manual keypair setup.

8. Health Checking

What: Wait for server health before considering deployment successful. Implementation:
Impact: Deployment only succeeds if server is actually running and healthy.

Deployment Flow

Complete Deployment Sequence

Port Mappings

Configuration

GitHub Secrets

Required secrets for Vast.ai deployment:

Workflow Triggers

Environment Variables

Monitoring

PM2 Commands

Health Checks

Diagnostic Logs

Troubleshooting

Deployment Fails

Check:
  1. SSH connection to Vast instance
  2. GitHub secrets are set
  3. Vast instance has enough disk space
Fix:

Database Connection Fails

Check:
  1. DATABASE_URL is set in /tmp/hyperscape-secrets.env
  2. Database is accessible from Vast instance
  3. Warmup step completed successfully
Fix:

PulseAudio Not Working

Check:
  1. PulseAudio is running
  2. chrome_audio sink exists
  3. XDG_RUNTIME_DIR is set
Fix:

Stream Not Appearing

Check:
  1. Stream keys are configured
  2. FFmpeg is running
  3. RTMP connection is established
Fix:

Health Check Timeout

Check:
  1. Server is actually starting
  2. No port conflicts
  3. Database connection works
Fix:

Performance

Resource Usage

Optimization Tips

  1. Reduce video bitrate for lower bandwidth:
  2. Disable audio if not needed:
  3. Use lower resolution:
  4. Disable model agents for lower CPU:

Best Practices

1. Monitor Logs

Always monitor logs after deployment:

2. Verify Health

Check health endpoint before considering deployment successful:

3. Test Streaming

Verify stream is live on all platforms:

4. Backup Secrets

Keep backup of secrets file:

References