Sluby

Quickstart

From git clone to a video playing from Sia, on one machine with Docker Compose.

This page takes you from an empty machine to a video you uploaded playing in the Studio, stored on Sia under your own account. Everything runs in Docker Compose on one machine and listens on http://localhost:8080. To serve it on a domain with TLS afterwards, continue with Run in production.

The steps, in order: create a sia.storage account, get the code, build, connect to Sia, start Sluby, create the first admin, upload a video, wait until it is ready, play it and share it.

Requirements

  • Docker with the Docker Compose plugin (the docker compose command) and BuildKit. The backend image builds only with BuildKit.
  • An x86-64 (amd64) or ARM64 (arm64) processor. On ARM64 the backend image compiles the Sia storage module from source while it builds.
  • Git.
  • A browser, and a short video file to upload (MP4, MOV, M4V, MKV, WebM or AVI). A clip of a few seconds is ready fastest.

To try Sluby on the Sia testnet without a sia.storage account, follow Run on the Zen testnet instead.

What runs

The stack in docker-compose.yml has four services:

ServiceImageRole
postgrespostgres:18-alpinethe database
redisredis:8-alpinethe job queues
backendbuilt from backend/Dockerfilethe API, the upload and transcoding workers, and video delivery
webbuilt from frontend/Dockerfilenginx serving the Studio and passing the API and delivery to the backend

Only web is published, on 127.0.0.1:8080. Data lives in the Docker volumes pgdata, redis-data, uploads, transcode-output and nginx-cache. How the parts work together: Architecture.

Install

Create a sia.storage account

Sluby stores videos on Sia through an indexer, and sia.storage is the hosted one it connects to by default. Open sia.storage, click Get Started and create an account. The free plan includes 50 GB. Stay signed in in this browser: you approve Sluby's connection here in a later step.

Get the code

git clone https://github.com/justmert/Sluby.git
cd Sluby

Run every later command in this folder.

Create .env

cp .env.example .env

The defaults in .env.example run the local stack against sia.storage with sign-in turned on. Every setting is described in the configuration reference.

Build the images

docker compose build

Connect to Sia

docker compose run --rm --no-deps backend node scripts/connect-indexer.mjs

The script prints a URL and waits. Open the URL in the browser where you are signed in to sia.storage and approve the connection. The script continues on its own. The script then prints three lines:

.env
SIA_INDEXER_URL=https://sia.storage
SIA_APP_ID=<64 hex characters>
SIA_APP_KEY=<64 hex characters>

In .env, replace the SIA_INDEXER_URL, SIA_APP_ID and SIA_APP_KEY lines with these three. Details, and how to use another indexer: Connect Sia storage.

Start Sluby

docker compose up -d

The backend applies the database migrations before it starts. web starts once the backend reports healthy. Check that all four services are up:

docker compose ps

Find the setup code

docker compose logs backend | grep "setup code"

The matching line ends with this message, with your code in place of XXXXX-XXXXX:

No admin can sign in yet. Open http://localhost:8080/studio and set up the first admin with the setup code XXXXX-XXXXX.

More about the setup code: Set up sign-in.

Create the first admin

Open http://localhost:8080. It redirects to the Studio at /studio, which opens on Set up Sluby Studio while the server has no admin. Fill in Setup code, Your name, Email and Password (at least 10 characters) and click Create admin account. The Studio signs you in.

Upload a video

Click Upload video at the top of the sidebar. Drag your video file onto the box that reads Drop video files here, or click Choose files. Check the Title, leave Who can watch on Public, and click Start upload.

The file row shows the upload's progress, then "File sent. Waiting for the server to confirm." More options, such as private videos and several files at once: Upload a video.

Wait until it is ready

The server now converts the video into several qualities and stores them on Sia. The file row names each stage with a percentage: Transcoding, then Storing on Sia, then Publishing. You can leave the page; processing continues on the server.

When the video is ready, the row turns into a check mark with the title as a link. A clip of a few seconds takes a few minutes, most of it storing on Sia. A longer video takes longer, because every quality is stored. If a stage fails, see Follow processing and retry.

Play it

Click the title in the file row, or open Videos in the sidebar and click the video. Press play in the player at the top of the video page. The badge next to the Quality menu shows how the video reaches your browser; with this setup it reads From Sia via this server: the server reads the video from Sia and passes it on. To have browsers read most of the video straight from the Sia hosts, set up Stream from Sia in the browser.

The Storage tab under the player shows how the video is stored on Sia: how many files, on how many hosts, in which countries (See how a video is stored on Sia).

Share it

Click Copy embed code next to the title and paste the iframe into any web page, or click the Share tab under the player for the watch page link and code for React and plain HTML. While the server listens only on localhost, those links work only on this machine; Run in production puts it on a domain. More: Share or embed a video.

Next steps

On this page