---
title: "Deploy Youtube Alternative"
description: "Video streaming  platform —  live, uploads, transcoding and more."
category: "Other"
url: https://railway.com/deploy/youtube-alternative
---

# Deploy Youtube Alternative

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

**[Deploy Youtube Alternative on Railway](https://railway.com/template/youtube-alternative)**

- **Category:** Other

## Template content

### postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### Peertube

- **Image:** chocobozzz/peertube:production
- **Public domain:** Yes

### redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

## Documentation

# 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](https://docs.joinpeertube.org/assets/landing-page.Rl3b_haN.jpg)

## 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

| Dependency     | Purpose                                                                    |
| -------------- | -------------------------------------------------------------------------- |
| PostgreSQL 17  | Stores users, videos, metadata, comments, and application data.            |
| Redis          | Handles background jobs, transcoding queues, and asynchronous tasks.       |
| Railway Volume | Persists uploaded videos, thumbnails, HLS assets, and configuration files. |

### Deployment Dependencies

| Resource               | Link                                   |
| ---------------------- | -------------------------------------- |
| Official Documentation | https://docs.joinpeertube.org/         |
| PeerTube Website       | https://joinpeertube.org/              |
| GitHub Repository      | https://github.com/Chocobozzz/PeerTube |

### Implementation Details

#### Docker

This template deploys the following Railway services:

| Service    | Image                        |
| ---------- | ---------------------------- |
| PeerTube   | `nomideusz/peertube-railway` |
| PostgreSQL | `postgres:17-alpine`         |
| Redis      | `redis:7-alpine`             |

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

#### Public Networking

##### HTTP Access

| Setting     | Value      |
| ----------- | ---------- |
| Proxy Type  | HTTP Proxy |
| Target Port | 9000       |

##### Live Streaming

| Setting     | Value     |
| ----------- | --------- |
| Proxy Type  | TCP Proxy |
| Target Port | 1935      |

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

| Variable                      | Required | Description                                            |
| ----------------------------- | :------: | ------------------------------------------------------ |
| `PORT`                        |    Yes   | HTTP port used by PeerTube.                            |
| `PEERTUBE_SECRET`             |    Yes   | Secret used to secure the PeerTube instance.           |
| `PEERTUBE_DB_NAME`            |    Yes   | PostgreSQL database name.                              |
| `PEERTUBE_DB_HOSTNAME`        |    Yes   | Railway PostgreSQL private hostname.                   |
| `PEERTUBE_DB_PORT`            |    Yes   | PostgreSQL port.                                       |
| `PEERTUBE_DB_USERNAME`        |    Yes   | PostgreSQL username.                                   |
| `PEERTUBE_DB_PASSWORD`        |    Yes   | PostgreSQL password.                                   |
| `PEERTUBE_DB_SSL`             |    Yes   | Enables or disables PostgreSQL SSL.                    |
| `PEERTUBE_REDIS_HOSTNAME`     |    Yes   | Railway Redis private hostname.                        |
| `PEERTUBE_WEBSERVER_HOSTNAME` |    Yes   | Public hostname for your PeerTube instance.            |
| `PEERTUBE_ADMIN_EMAIL`        |    Yes   | Administrator email address.                           |
| `PT_INITIAL_ROOT_PASSWORD`    |    Yes   | Initial password for the `root` administrator account. |
| `NODE_CONFIG_DIR`             |    Yes   | Configuration directory search path.                   |
| `PEERTUBE_LOCAL_CONFIG`       |    Yes   | Persistent configuration directory.                    |

Example:

```env
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:

```text
/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 &amp; 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):

```text
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.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/youtube-alternative
