Deploying Tube
Introduction
Tube is a lightweight, self-hosted video sharing platform that provides a YouTube-like experience for your own videos. Built with Go, Tube offers a simple way to host and share video content without relying on third-party platforms, keeping full control over your media and viewer data.
Unlike complex media servers, Tube focuses on simplicity and ease of use. Point it at a directory of videos, and it automatically generates a browsable library with thumbnails, streaming playback, and RSS feeds. Perfect for personal video archives, educational content, or internal company videos.
Key highlights of Tube:
- Simple Setup: Just point at a video directory and Tube handles the rest
- Auto-Thumbnails: Automatically generates video thumbnails using ffmpeg
- Responsive Design: Works on desktop, tablet, and mobile devices
- RSS Feeds: Built-in RSS feed generation for podcast-style subscriptions
- No Database: File-based with no external database requirements
- Fast Streaming: Efficient video streaming with range request support
- Customizable: Configure library name, description, and appearance
- Low Resource Usage: Lightweight Go binary with minimal memory footprint
- Privacy Focused: No tracking, no ads, no third-party services
- Open Source: MIT licensed for full transparency
This guide walks through deploying Tube on Klutch.sh using Docker, organizing your video library, and configuring the platform for video sharing.
Why Deploy Tube on Klutch.sh
Deploying Tube on Klutch.sh provides several advantages for video hosting:
Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Tube without complex configuration. Push to GitHub, and your video platform deploys automatically.
Persistent Storage: Attach persistent volumes for your video library and generated thumbnails. Your content survives container restarts and redeployments.
HTTPS by Default: Klutch.sh provides automatic SSL certificates, ensuring secure video streaming from anywhere.
Scalable Storage: Allocate storage based on your video library size and scale as your collection grows.
Always-On Streaming: Your videos remain accessible 24/7 without managing your own hardware or bandwidth.
Prerequisites
Before deploying Tube on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your Tube configuration
- Basic familiarity with Docker and containerization concepts
- Video files ready to upload (MP4, WebM, or other supported formats)
- (Optional) A custom domain for your Tube instance
Understanding Tube Architecture
Tube is designed for simplicity:
Go Binary: A single compiled binary handles web serving, video streaming, and thumbnail generation.
Video Directory: Tube watches a configured directory for video files and serves them through the web interface.
Thumbnail Cache: FFmpeg-generated thumbnails are cached for efficient browsing.
Static Frontend: A responsive HTML/CSS/JavaScript frontend served directly by the Go server.
No Database: All metadata comes from file names and optional sidecar files.
Preparing Your Repository
To deploy Tube on Klutch.sh, create a GitHub repository containing your Dockerfile and configuration.
Repository Structure
tube-deploy/├── Dockerfile├── config.json└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM prologic/tube:latest
# Set environment variablesENV TUBE_LIBRARY=/videosENV TUBE_TITLE=${TUBE_TITLE:-My Video Library}ENV TUBE_DESCRIPTION=${TUBE_DESCRIPTION:-A self-hosted video library}
# Create directoriesRUN mkdir -p /videos /data
# Copy configuration if neededCOPY config.json /data/config.json
# Expose the web interface portEXPOSE 8000
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:8000/ || exit 1Configuration File
Create config.json for your Tube configuration:
{ "library": "/videos", "title": "My Video Library", "description": "A self-hosted video platform", "feed": { "external_url": "https://your-domain.klutch.sh", "title": "My Video Library", "link": "https://your-domain.klutch.sh", "description": "Video RSS Feed", "author": { "name": "Your Name", "email": "you@example.com" }, "copyright": "Copyright 2024" }}Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
TUBE_LIBRARY | No | /videos | Path to the video library directory |
TUBE_TITLE | No | tube | Title displayed in the web interface |
TUBE_DESCRIPTION | No | - | Description for the library |
Deploying Tube on Klutch.sh
Once your repository is prepared, follow these steps to deploy Tube:
- Select HTTP as the traffic type
- Set the internal port to 8000 (Tube default port)
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the Tube container
- Provision an HTTPS certificate
Push Your Repository to GitHub
Initialize your repository and push to GitHub:
git initgit add Dockerfile config.json .dockerignoregit commit -m "Initial Tube deployment configuration"git remote add origin https://github.com/yourusername/tube-deploy.gitgit push -u origin mainCreate a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “tube” or “videos”.
Create a New App
Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Tube Dockerfile.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
In the environment variables section, add the following:
| Variable | Value |
|---|---|
TUBE_TITLE | Your library name |
TUBE_DESCRIPTION | Your library description |
Attach Persistent Volumes
Persistent storage is essential for Tube. Add the following volumes:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/videos | 50+ GB | Video files (adjust based on library size) |
/data | 1 GB | Configuration and thumbnail cache |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Access Tube
Once deployment completes, access your Tube instance at https://your-app-name.klutch.sh. The interface will show your video library.
Organizing Your Video Library
File Naming
Name your video files descriptively for best results:
/videos/├── My Vacation 2023.mp4├── Tutorial - Getting Started.webm├── Conference Talk - Tech Topic.mp4└── Family Event.mp4Folder Organization
Create folders to organize videos by category:
/videos/├── tutorials/│ ├── beginner/│ │ └── intro.mp4│ └── advanced/│ └── deep-dive.mp4├── vlogs/│ └── week1.mp4└── presentations/ └── keynote.mp4Supported Formats
Tube supports common video formats:
- MP4 (H.264)
- WebM (VP8/VP9)
- MKV
- AVI
- MOV
For best compatibility, use MP4 with H.264 encoding.
Uploading Videos
Using SFTP/SCP
Upload videos directly to your persistent volume:
scp video.mp4 user@storage:/videos/Web Upload Tools
Deploy a companion file manager alongside Tube for web-based uploads.
Sync Tools
Use rclone or similar tools to synchronize from local storage:
rclone sync /local/videos remote:/videosRSS Feed
Enabling RSS
Tube automatically generates an RSS feed at /feed.xml. Configure feed details in your config.json:
{ "feed": { "external_url": "https://your-domain.klutch.sh", "title": "My Video Feed", "description": "Subscribe to my videos" }}Podcast Clients
Your feed works with podcast clients that support video:
- iTunes/Apple Podcasts
- Overcast
- Pocket Casts
- Generic RSS readers
Customization
Thumbnails
Tube automatically generates thumbnails using FFmpeg. Thumbnails are cached after first generation.
Custom Thumbnails
Override automatic thumbnails by placing a matching image file:
/videos/├── my-video.mp4└── my-video.jpg # Custom thumbnailProduction Best Practices
Video Encoding
Optimize videos for streaming:
- Use H.264 codec for broad compatibility
- Set keyframe interval for efficient seeking
- Choose appropriate bitrate for your bandwidth
- Consider multiple quality levels
Storage Management
- Monitor available storage space
- Archive old videos as needed
- Clean up temporary files
Bandwidth Optimization
- Use appropriate video bitrates
- Enable HTTP caching headers
- Consider CDN for high-traffic sites
Troubleshooting Common Issues
Videos Not Appearing
Symptoms: Uploaded videos don’t show in the library.
Solutions:
- Verify video format is supported
- Check file permissions
- Restart the container to rescan library
Thumbnail Generation Fails
Symptoms: Videos appear without thumbnails.
Solutions:
- Verify FFmpeg is installed in the container
- Check video file is not corrupted
- Review container logs for errors
Streaming Issues
Symptoms: Videos buffer or won’t play.
Solutions:
- Check video encoding compatibility
- Verify sufficient bandwidth
- Try re-encoding with web-optimized settings
Additional Resources
Conclusion
Deploying Tube on Klutch.sh gives you a simple, privacy-focused video hosting platform accessible from anywhere. The combination of Tube’s lightweight design and Klutch.sh’s deployment simplicity means you can share videos without managing complex infrastructure.
With automatic thumbnail generation, RSS feeds, and responsive design, Tube provides everything you need for personal or small-scale video sharing. Your videos remain under your control, streaming securely from your own platform.