PeerTube Video Platform
PeerTube federated video hosting platform with ActivityPub support.
Overview
PeerTube is a decentralized video hosting platform that emerged as an open-source alternative to centralized services like YouTube. Built by Framasoft and launched in 2018, PeerTube leverages ActivityPub protocol for federation and WebTorrent technology for peer-to-peer video distribution. This approach reduces server bandwidth costs while creating a network of interconnected video platforms that can share content and audiences across instances. PostgreSQL serves as PeerTube's primary database, handling complex video metadata, user accounts, federation data, and comment systems with the reliability and ACID compliance required for content management platforms. Redis provides high-speed caching for video thumbnails, user sessions, and federation message queues, while also managing real-time features like live streaming coordination and background job processing. Content creators, educational institutions, and organizations seeking video hosting independence will find this stack particularly valuable for building sustainable video communities without relying on corporate platforms. The federation capabilities mean your instance can connect with thousands of other PeerTube servers worldwide, dramatically expanding your potential audience while maintaining full control over your content and community policies.
Key Features
- ActivityPub federation allowing content sharing and discovery across PeerTube instances worldwide
- WebTorrent peer-to-peer video streaming reducing server bandwidth costs through viewer participation
- RTMP live streaming support on port 1935 with Redis-coordinated real-time chat and viewer management
- PostgreSQL-powered advanced video categorization with tags, channels, playlists, and full-text search
- Redis-cached video transcoding queue management for multiple resolution and format processing
- Federated comment system allowing users from other ActivityPub platforms like Mastodon to interact
- Built-in video statistics and analytics stored in PostgreSQL with Redis performance optimization
- Multi-language subtitle support with PostgreSQL storage and Redis caching for fast retrieval
Common Use Cases
- 1Educational institutions hosting course videos with controlled access and student interaction features
- 2Independent content creators building audiences across federated PeerTube networks
- 3Organizations requiring GDPR-compliant video hosting with full data control and European server locations
- 4Community groups sharing event recordings and live streaming local meetings or conferences
- 5Businesses hosting product demonstrations and training videos without YouTube's advertising and algorithm constraints
- 6News organizations publishing video content with federation reach while maintaining editorial independence
- 7Gaming communities streaming gameplay and tournaments with integrated chat and community features
Prerequisites
- Minimum 4GB RAM (2GB for PostgreSQL, 1GB for PeerTube transcoding, 512MB for Redis caching)
- Docker host with ports 9000, 1935, 80, and 443 accessible for web interface and RTMP streaming
- Valid domain name and SSL certificate for PEERTUBE_HOSTNAME federation requirements
- Understanding of ActivityPub federation concepts and PeerTube instance administration
- Storage planning for video files as PeerTube data volume will grow significantly with uploads
- SMTP server configuration knowledge for user registration and notification emails
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 peertube: 3 image: chocobozzz/peertube:production-bookworm4 container_name: peertube5 environment: 6 - PEERTUBE_DB_USERNAME=${POSTGRES_USER}7 - PEERTUBE_DB_PASSWORD=${POSTGRES_PASSWORD}8 - PEERTUBE_DB_SSL=false9 - PEERTUBE_DB_HOSTNAME=postgres10 - PEERTUBE_REDIS_HOSTNAME=redis11 - PEERTUBE_WEBSERVER_HOSTNAME=${PEERTUBE_HOSTNAME}12 - PEERTUBE_WEBSERVER_PORT=44313 - PEERTUBE_WEBSERVER_HTTPS=true14 - PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.17.0.0/16"]15 - PEERTUBE_SECRET=${PEERTUBE_SECRET}16 - PEERTUBE_ADMIN_EMAIL=${PEERTUBE_ADMIN_EMAIL}17 - PT_INITIAL_ROOT_PASSWORD=${PT_INITIAL_ROOT_PASSWORD}18 volumes: 19 - peertube_data:/data20 - peertube_config:/config21 ports: 22 - "9000:9000"23 - "1935:1935"24 depends_on: 25 - postgres26 - redis27 networks: 28 - peertube-network2930 postgres: 31 image: postgres:16-alpine32 container_name: peertube-db33 environment: 34 - POSTGRES_USER=${POSTGRES_USER}35 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}36 - POSTGRES_DB=peertube37 volumes: 38 - postgres_data:/var/lib/postgresql/data39 networks: 40 - peertube-network4142 redis: 43 image: redis:7-alpine44 container_name: peertube-redis45 volumes: 46 - redis_data:/data47 networks: 48 - peertube-network4950volumes: 51 peertube_data: 52 peertube_config: 53 postgres_data: 54 redis_data: 5556networks: 57 peertube-network: 58 driver: bridge.env Template
.env
1# PeerTube2POSTGRES_USER=peertube3POSTGRES_PASSWORD=peertube_password4PEERTUBE_HOSTNAME=peertube.example.com5PEERTUBE_SECRET=your-peertube-secret6PEERTUBE_ADMIN_EMAIL=admin@example.com7PT_INITIAL_ROOT_PASSWORD=your_root_passwordUsage Notes
- 1Web interface at http://localhost:9000
- 2Login as root with initial password
- 3Supports federation with other instances
- 4Live streaming via RTMP
- 5Configure hostname for production
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
peertube
peertube:
image: chocobozzz/peertube:production-bookworm
container_name: peertube
environment:
- PEERTUBE_DB_USERNAME=${POSTGRES_USER}
- PEERTUBE_DB_PASSWORD=${POSTGRES_PASSWORD}
- PEERTUBE_DB_SSL=false
- PEERTUBE_DB_HOSTNAME=postgres
- PEERTUBE_REDIS_HOSTNAME=redis
- PEERTUBE_WEBSERVER_HOSTNAME=${PEERTUBE_HOSTNAME}
- PEERTUBE_WEBSERVER_PORT=443
- PEERTUBE_WEBSERVER_HTTPS=true
- PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.17.0.0/16"]
- PEERTUBE_SECRET=${PEERTUBE_SECRET}
- PEERTUBE_ADMIN_EMAIL=${PEERTUBE_ADMIN_EMAIL}
- PT_INITIAL_ROOT_PASSWORD=${PT_INITIAL_ROOT_PASSWORD}
volumes:
- peertube_data:/data
- peertube_config:/config
ports:
- "9000:9000"
- "1935:1935"
depends_on:
- postgres
- redis
networks:
- peertube-network
postgres
postgres:
image: postgres:16-alpine
container_name: peertube-db
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=peertube
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- peertube-network
redis
redis:
image: redis:7-alpine
container_name: peertube-redis
volumes:
- redis_data:/data
networks:
- peertube-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 peertube:5 image: chocobozzz/peertube:production-bookworm6 container_name: peertube7 environment:8 - PEERTUBE_DB_USERNAME=${POSTGRES_USER}9 - PEERTUBE_DB_PASSWORD=${POSTGRES_PASSWORD}10 - PEERTUBE_DB_SSL=false11 - PEERTUBE_DB_HOSTNAME=postgres12 - PEERTUBE_REDIS_HOSTNAME=redis13 - PEERTUBE_WEBSERVER_HOSTNAME=${PEERTUBE_HOSTNAME}14 - PEERTUBE_WEBSERVER_PORT=44315 - PEERTUBE_WEBSERVER_HTTPS=true16 - PEERTUBE_TRUST_PROXY=["127.0.0.1", "loopback", "172.17.0.0/16"]17 - PEERTUBE_SECRET=${PEERTUBE_SECRET}18 - PEERTUBE_ADMIN_EMAIL=${PEERTUBE_ADMIN_EMAIL}19 - PT_INITIAL_ROOT_PASSWORD=${PT_INITIAL_ROOT_PASSWORD}20 volumes:21 - peertube_data:/data22 - peertube_config:/config23 ports:24 - "9000:9000"25 - "1935:1935"26 depends_on:27 - postgres28 - redis29 networks:30 - peertube-network3132 postgres:33 image: postgres:16-alpine34 container_name: peertube-db35 environment:36 - POSTGRES_USER=${POSTGRES_USER}37 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}38 - POSTGRES_DB=peertube39 volumes:40 - postgres_data:/var/lib/postgresql/data41 networks:42 - peertube-network4344 redis:45 image: redis:7-alpine46 container_name: peertube-redis47 volumes:48 - redis_data:/data49 networks:50 - peertube-network5152volumes:53 peertube_data:54 peertube_config:55 postgres_data:56 redis_data:5758networks:59 peertube-network:60 driver: bridge61EOF6263# 2. Create the .env file64cat > .env << 'EOF'65# PeerTube66POSTGRES_USER=peertube67POSTGRES_PASSWORD=peertube_password68PEERTUBE_HOSTNAME=peertube.example.com69PEERTUBE_SECRET=your-peertube-secret70PEERTUBE_ADMIN_EMAIL=admin@example.com71PT_INITIAL_ROOT_PASSWORD=your_root_password72EOF7374# 3. Start the services75docker compose up -d7677# 4. View logs78docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/peertube-video/run | bashTroubleshooting
- Federation not working with other instances: Verify PEERTUBE_WEBSERVER_HOSTNAME matches your actual domain and SSL certificate is valid
- Video transcoding fails or hangs: Increase Docker memory limits and check PeerTube container logs for ffmpeg errors
- Redis connection errors in PeerTube logs: Ensure redis container is fully started before PeerTube using healthchecks or init containers
- PostgreSQL connection refused: Check that POSTGRES_USER and POSTGRES_PASSWORD environment variables match between postgres and peertube services
- RTMP live streaming not working: Verify port 1935 is open in firewall and not blocked by hosting provider
- High memory usage during video uploads: Configure Redis maxmemory settings and consider enabling PostgreSQL connection pooling
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
peertubepostgresredis
Tags
#peertube#video#federated#youtube-alternative#activitypub
Category
Media & EntertainmentAd Space
Shortcuts: C CopyF FavoriteD Download