Skip to content

Self‐hosting

bitwise edited this page Oct 31, 2025 · 1 revision

Table of contents

Hosting with Docker

Important

This assumes you have docker set-up and working correctly

Caution

Using the GPU with ffmpeg will not work while using docker compose! You have to use plain docker for that

  1. Pull the docker container and all other required containers
docker pull bitwise74/vidsh:latest
docker pull valkey/valkey # Only needed if you plan on using redis cache
  1. Prepare your environment

You can use docker compose here if you're not planning on using the GPU with ffmpeg

# Rename the example env file
mv .env.example .env

# Fill out the env file
nvim .env

# Create an empty SQLite database
touch database.db
  1. Setup valkey (skip if not using redis cache)
docker run \
       --name valkey_server \
       --network vidsh \
       -- valkey/valkey:latest \
       valkey-server --requirepass "your password here" --appendonly yes
  1. Run the docker container
docker run \
       --name vidsh-backend \
       --network vidsh \
       --runtime nvidia --device=nvidia.com/gpu=all \ # This is required to use your Nvidia GPU with ffmpeg. Skip if you're not planning to
       --env-file /path/to/.env \
       -it \
       -p 8888:8888 \ # Specify the port to expose (HAS TO ALIGN WITH .ENV)
       --volume /path/to/database.db:/app/database.db \
       bitwise74/vidsh:latest \
       -d

After that you can try to curl -I http://localhost:8888/api/heartbeat to check if the server is alive. You should see something like this:

> curl -I http://localhost:8888/api/heartbeat
HTTP/1.1 200 OK
Date: ...
  1. Setup a reverse proxy (recommended) It's a good idea to protect your server with nginx if it's gonna face the public internet. You can use the following nginx configuration for a headstart, but you should still research what everything does. Below you'll find a version for HTTPS connections
server {
    if ($host = bitwise0x.dev) {
        return 301 https://$host$request_uri;
    }


    listen 80;
    server_name www.example.com example.com;

    # Redirect all HTTP requests to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name www.example.com example.com;

    # Specify the max file size here too
    client_max_body_size 2048m;

    ssl_certificate /path/to/your/certificate
    ssl_certificate_key /path/to/your/certificate/key

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;

    # Proxy traffic to frontend
    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Proxy traffic to backend
    location /api/ {
        proxy_pass http://localhost:8888;
        proxy_http_version 1.1;

        client_max_body_size 2048m;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_buffering off;
        proxy_request_buffering off;
        proxy_read_timeout 3600s;
    }
}

Clone this wiki locally