Federated Video
    ActivityPub

    Deploy PeerTube on a VPS

    Self-host PeerTube, a federated ActivityPub video platform, on a RamNode VPS with Docker Compose, PostgreSQL, Redis, and Nginx TLS.

    PeerTube is a federated (ActivityPub) video hosting platform. It has more moving parts than Owncast or MediaMTX — PostgreSQL, Redis, and optionally an SMTP relay — so the officially recommended path is Docker Compose, which is what this guide uses.

    Assumptions: Ubuntu 22.04/24.04 VPS with at least 2 vCPU / 4GB RAM (PeerTube + transcoding is memory- and CPU-hungry — check your RamNode plan's specs before proceeding), root/sudo access, and a domain (e.g. videos.example.com) pointed at the VPS.


    1. Initial server prep

    shell
    sudo apt update && sudo apt upgrade -y
    sudo apt install -y curl wget ufw nginx certbot python3-certbot-nginx apt-transport-https ca-certificates gnupg

    2. Install Docker and Docker Compose

    shell
    curl -fsSL https://get.docker.com | sudo sh
    sudo usermod -aG docker $USER
    newgrp docker

    Verify:

    shell
    docker --version
    docker compose version

    3. Configure the firewall

    shell
    sudo ufw allow OpenSSH
    sudo ufw allow 'Nginx Full'
    sudo ufw enable

    PeerTube's own container ports stay bound to 127.0.0.1 and are reached only through Nginx, so no extra ports need opening (RTMP live streaming, if enabled, uses 1935 — add it if you plan to use PeerTube's live feature: sudo ufw allow 1935/tcp).

    4. Set up the PeerTube directory and Compose files

    shell
    sudo mkdir -p /var/www/peertube
    sudo chown $USER:$USER /var/www/peertube
    cd /var/www/peertube
    
    curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/docker/production/docker-compose.yml -o docker-compose.yml
    curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/docker/production/.env -o .env

    5. Configure the .env file

    shell
    nano .env

    Set at minimum:

    shell
    PEERTUBE_HOSTNAME=videos.example.com
    PEERTUBE_ADMIN_EMAIL=you@example.com
    
    POSTGRES_USER=peertube
    POSTGRES_PASSWORD=CHANGE_ME_TO_A_LONG_RANDOM_STRING
    POSTGRES_DB=peertube
    
    # SMTP - required for account confirmation / notifications
    PEERTUBE_SMTP_HOSTNAME=smtp.yourprovider.com
    PEERTUBE_SMTP_PORT=587
    PEERTUBE_SMTP_USERNAME=you@example.com
    PEERTUBE_SMTP_PASSWORD=your-smtp-password
    PEERTUBE_SMTP_FROM=you@example.com

    Generate a strong Postgres password:

    shell
    openssl rand -hex 24

    6. Start the stack

    shell
    docker compose up -d

    This pulls and starts three containers: peertube, postgres, and redis. First startup runs database migrations and can take a couple of minutes.

    shell
    docker compose logs -f peertube

    Wait until you see it listening on port 9000 internally before moving on.

    7. Reverse proxy with Nginx + TLS

    PeerTube publishes an official Nginx template. Grab it:

    shell
    sudo curl https://raw.githubusercontent.com/Chocobozzz/PeerTube/develop/support/nginx/peertube -o /etc/nginx/sites-available/peertube

    Edit it and replace the server_name and webserver_host placeholders with videos.example.com, and confirm it proxies to 127.0.0.1:9000 (PeerTube's default internal port):

    shell
    sudo nano /etc/nginx/sites-available/peertube

    Enable it and issue a cert:

    shell
    sudo ln -s /etc/nginx/sites-available/peertube /etc/nginx/sites-enabled/peertube
    sudo nginx -t && sudo systemctl reload nginx
    sudo certbot --nginx -d videos.example.com

    The official template already includes the large client_max_body_size and long timeout values needed for big video uploads — don't shrink them.

    8. Create your admin account

    The root user's password is generated on first boot. Retrieve it:

    shell
    docker compose logs peertube | grep -A1 "username"

    Log in at https://videos.example.com/login, then immediately change the password in Account Settings.

    9. Post-install configuration

    In the admin panel (/admin/config):

    • Set instance name, description, terms
    • Configure Transcoding — enable only the resolutions your VPS's CPU can realistically handle; PeerTube transcoding is the single biggest resource consumer
    • Configure storage quotas per user
    • If federating, review the federation/moderation settings before opening registrations

    10. Ongoing maintenance

    • Update: cd /var/www/peertube && docker compose pull && docker compose up -d
    • Logs: docker compose logs -f peertube
    • Back up: the ./data volume directory in /var/www/peertube (videos, config) and a pg_dump of the Postgres container
    • Disk space: video storage grows fast — monitor with df -h and consider attaching RamNode block storage if you outgrow local disk

    Troubleshooting

    SymptomCheck
    502 from Nginxdocker compose ps — is the peertube container healthy? docker compose logs peertube
    Uploads fail partwayclient_max_body_size in Nginx config, and disk space
    Videos stuck "transcoding"CPU load (htop) — you may have enabled too many resolutions for your vCPU count
    Can't send confirmation emailsDouble check SMTP credentials in .env, then docker compose up -d to reload