Railway

Deploy Youtube Alternative

Video streaming platform — live, uploads, transcoding and more.

Deploy Youtube Alternative

/var/lib/postgresql/data

Just deployed

/data

Just deployed

/data

Deploy and Host PeerTube on Railway

PeerTube is an open-source, decentralized video hosting platform that lets you build your own YouTube-like service. It supports video uploads, live streaming, HLS transcoding, channels, playlists, user accounts, and optional federation through ActivityPub, giving creators, communities, and organizations complete ownership of their video platform and content.

PeerTube

About Hosting PeerTube

Hosting PeerTube on Railway provides a fully managed environment for running your own video platform without maintaining servers or networking infrastructure. This template deploys three Railway services: the PeerTube application, PostgreSQL for persistent data storage, and Redis for background jobs and queues. A Railway Volume stores uploaded videos, thumbnails, HLS assets, and configuration files, while Railway automatically provisions HTTPS and private networking between services. Live streaming is supported through a Railway TCP Proxy on port 1935, allowing broadcasting software such as OBS to publish directly to your instance. As your library grows, Railway makes it easy to scale compute resources and storage while handling the underlying infrastructure.

Common Use Cases

  • Launch a creator-owned video platform with complete control over branding and content.
  • Build a company, educational, or community video portal with channels, playlists, and user accounts.
  • Host live streams and participate in the decentralized Fediverse through ActivityPub federation.

Dependencies for PeerTube Hosting

DependencyPurpose
PostgreSQL 17Stores users, videos, metadata, comments, and application data.
RedisHandles background jobs, transcoding queues, and asynchronous tasks.
Railway VolumePersists uploaded videos, thumbnails, HLS assets, and configuration files.

Deployment Dependencies

ResourceLink
Official Documentationhttps://docs.joinpeertube.org/
PeerTube Websitehttps://joinpeertube.org/
GitHub Repositoryhttps://github.com/Chocobozzz/PeerTube

Implementation Details

Docker

This template deploys the following Railway services:

ServiceImage
PeerTubenomideusz/peertube-railway
PostgreSQLpostgres:17-alpine
Redisredis:7-alpine

Railway automatically deploys all services from their container images. No custom build or start commands are required.

Public Networking

HTTP Access
SettingValue
Proxy TypeHTTP Proxy
Target Port9000
Live Streaming
SettingValue
Proxy TypeTCP Proxy
Target Port1935

Generate a Railway domain from Settings → Networking → Generate Domain to access PeerTube over HTTPS.

To enable RTMP live streaming:

  1. Open Settings → Networking.
  2. Add a TCP Proxy.
  3. Set the application port to 1935.

Environment Variables

VariableRequiredDescription
PORTYesHTTP port used by PeerTube.
PEERTUBE_SECRETYesSecret used to secure the PeerTube instance.
PEERTUBE_DB_NAMEYesPostgreSQL database name.
PEERTUBE_DB_HOSTNAMEYesRailway PostgreSQL private hostname.
PEERTUBE_DB_PORTYesPostgreSQL port.
PEERTUBE_DB_USERNAMEYesPostgreSQL username.
PEERTUBE_DB_PASSWORDYesPostgreSQL password.
PEERTUBE_DB_SSLYesEnables or disables PostgreSQL SSL.
PEERTUBE_REDIS_HOSTNAMEYesRailway Redis private hostname.
PEERTUBE_WEBSERVER_HOSTNAMEYesPublic hostname for your PeerTube instance.
PEERTUBE_ADMIN_EMAILYesAdministrator email address.
PT_INITIAL_ROOT_PASSWORDYesInitial password for the root administrator account.
NODE_CONFIG_DIRYesConfiguration directory search path.
PEERTUBE_LOCAL_CONFIGYesPersistent configuration directory.

Example:

PORT=9000
NODE_CONFIG_DIR=/app/config:/app/support/docker/production/config:/data/config
PEERTUBE_DB_SSL=false
PEERTUBE_SECRET=${{secret(64)}}

PEERTUBE_DB_NAME=${{Postgres.POSTGRES_DB}}
PEERTUBE_DB_HOSTNAME=${{Postgres.RAILWAY_PRIVATE_DOMAIN}}
PEERTUBE_DB_PORT=5432
PEERTUBE_DB_USERNAME=${{Postgres.POSTGRES_USER}}
PEERTUBE_DB_PASSWORD=${{Postgres.POSTGRES_PASSWORD}}

PEERTUBE_REDIS_HOSTNAME=${{Redis.RAILWAY_PRIVATE_DOMAIN}}

PEERTUBE_LOCAL_CONFIG=/data/config
PEERTUBE_WEBSERVER_HOSTNAME=${{RAILWAY_PUBLIC_DOMAIN}}

PEERTUBE_ADMIN_EMAIL=admin@example.com
PT_INITIAL_ROOT_PASSWORD=${{secret(16)}}

Use Railway reference variables for PostgreSQL and Redis connection details whenever possible.

Persistent Storage

PeerTube requires persistent storage for uploaded videos, thumbnails, HLS assets, and application configuration.

To add a Railway Volume:

  1. Open the PeerTube service.
  2. Go to Settings → Volumes.
  3. Click Add Volume.
  4. Mount the volume at:
/data

For larger deployments, PeerTube also supports S3-compatible object storage using the PEERTUBE_OBJECT_STORAGE_* environment variables. This is recommended when your media library outgrows a single Railway Volume.

Database

This template requires both PostgreSQL and Redis.

  • Add the Railway PostgreSQL service.
  • Add the Railway Redis service.
  • Configure PeerTube using the Railway reference variables.

PostgreSQL stores all persistent application data, including users, videos, comments, and metadata.

Redis is used for background jobs and transcoding queues. It is intentionally ephemeral—if Redis restarts, only queued but unprocessed jobs are lost. Persistent application data remains safely stored in PostgreSQL and the Railway Volume.

Build & Start

The application is deployed from the provided Docker image.

No custom build or start commands are required.

Accessing the Application

After deployment:

  1. Generate a Railway public domain.
  2. Open the generated URL.
  3. Log in with the username root using the password stored in PT_INITIAL_ROOT_PASSWORD.
  4. Change the administrator password immediately.
  5. Configure your instance, create channels, and upload your first videos.

To enable live streaming:

  1. Open Administration → Configuration → Live Streaming.
  2. Enable live streaming.
  3. Create a live video to obtain a stream key.
  4. Configure OBS (or another RTMP client):
Server: rtmp:///live
Stream Key: 

Operational Notes

  • Video transcoding runs on CPU using the bundled FFmpeg. HD video processing may take longer than real time. Consider reducing enabled transcoding profiles if you don't require multiple output resolutions.
  • Configure the PEERTUBE_SMTP_* environment variables to enable registration emails, password resets, and other email notifications.
  • If you later attach a custom domain, update PEERTUBE_WEBSERVER_HOSTNAME before enabling federation, as this hostname becomes your instance's federated identity.

Why Deploy PeerTube on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying PeerTube on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Rocky Linux
[Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
29
View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
71
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
51