Skip to content

Self-Hosting Runbook

brūhi Cloud is distributed as a consolidated container supervised by supervisord, containing the FastAPI web backend, SvelteKit frontend, and the native bruhi-audio broadcast playout engine. In production, it pairs with an automated Caddy reverse proxy for automated SSL/TLS certificate provisioning and HTTP/3 support.


Before starting deployment, ensure your server meets the following requirements:

  • CPU: 2 cores minimum (4+ cores recommended for multi-station setups).
  • RAM: 2 GB minimum (4 GB+ recommended; includes 256 MB RAM reserved for the in-memory tmpfs HLS cache).
  • Disk: 15 GB+ SSD storage (sized according to your station audio library and recordings).
  • Architecture: linux/amd64 (x86_64) or linux/arm64 (aarch64 / Graviton / Apple Silicon).
  • Operating System: Linux (Ubuntu 22.04+, Debian 12+, Fedora 38+, or Amazon Linux 2023).
  • Docker Engine: Version 24.0 or newer.
  • Docker Compose: Version v2.20 or newer (Compose V2 plugin via docker compose).

Configure your domain’s DNS A (or AAAA) record to point to your server’s public IP address (e.g., radio.yourdomain.com). Open the following ports in your firewall:

PortProtocolServicePurpose
80TCPHTTPACME Let’s Encrypt certificate challenge and HTTPS redirect
443TCP & UDPHTTPS & HTTP/3 (QUIC)Secure web dashboard, studio WebSockets, HLS audio streams
8000TCPInternal HTTP APIDirect container port (leave closed to public; accessible locally)

Section titled “Deployment Option A: Automated Installer (Recommended)”

The quickest way to bootstrap brūhi Cloud on a fresh server is the official interactive installer:

Terminal window
bash <(curl -fsSL https://raw.githubusercontent.com/bruhi-technologies/bruhi-deploy/main/install.sh)

The setup script:

  1. Validates that Docker and Docker Compose V2 are installed.
  2. Prompts for your public broadcast domain (e.g. radio.yourdomain.com).
  3. Downloads the official docker-compose.yml, Caddyfile, and generates .env.
  4. Pulls the latest container images and launches the stack.

Deployment Option B: Manual Docker Compose

Section titled “Deployment Option B: Manual Docker Compose”
  1. Create the Deployment Directory

    Terminal window
    mkdir -p ~/bruhi-cloud && cd ~/bruhi-cloud
  2. Download Deployment Configuration

    Terminal window
    curl -fsSL https://raw.githubusercontent.com/bruhi-technologies/bruhi-deploy/main/docker-compose.yml -o docker-compose.yml
    curl -fsSL https://raw.githubusercontent.com/bruhi-technologies/bruhi-deploy/main/Caddyfile -o Caddyfile
    curl -fsSL https://raw.githubusercontent.com/bruhi-technologies/bruhi-deploy/main/.env.example -o .env

    Your directory layout should be:

    • Directory~/bruhi-cloud/
      • .env
      • Caddyfile
      • docker-compose.yml
  3. Configure Environment Variables (.env)

    Edit .env using your text editor:

    # ── Public Domain & URLs ──────────────────────────────────
    # Used by Caddy for automated Let's Encrypt certificates
    DOMAIN=radio.yourdomain.com
    # Public application URL for invitations and links
    BRUHI_URL=https://radio.yourdomain.com
    # WebAuthn (Passkeys) — Must match your public hostname
    BRUHI_RP_ID=radio.yourdomain.com
    BRUHI_RP_NAME=brūhi Cloud
    # ── Environment & Security ────────────────────────────────
    BRUHI_ENV=production
    SESSION_COOKIE_SECURE=true
    LOG_LEVEL=info
    PORT=8000
    # Optional: Pre-seed owner credentials on first boot
    # BRUHI_ADMIN_EMAIL=owner@station.internal
    # BRUHI_ADMIN_PASSWORD=change_this_secure_password
  4. Start the Stack

    Terminal window
    docker compose up -d
  5. Verify System Health

    Test that the container and internal health check respond cleanly:

    Terminal window
    docker compose ps
    curl -f http://localhost:8000/healthz
    # Expected response: {"status":"ok"}

Once the containers are running and your domain resolves, complete the initial setup:

  1. Navigate to https://radio.yourdomain.com in your web browser.
  2. The First-Run Setup Wizard (/setup) will automatically activate if no database exists.
  3. Enter the Primary Owner Account details (email and master password). The very first user created is automatically assigned the immutable owner role.
  4. Enter your brūhi Licence Key (or select Community mode).
  5. The system initializes default Station 1 and redirects you to the live studio console.

brūhi Cloud uses Caddy 2.8+ as its frontend ingress proxy:

  • Automatic Let’s Encrypt Certificates: Caddy contacts Let’s Encrypt or ZeroSSL automatically on port 80/443 and manages renewal.
  • HTTP/3 (QUIC) Acceleration: Port 443/udp enables HTTP/3 for low-latency live audio streaming.
  • In-Memory HLS Delivery: Caddy mounts the hls_data tmpfs volume directly (/hls:ro), delivering .m3u8 playlists and audio chunks with zero Python overhead.
  • Custom Reverse Proxies (NGINX / Cloudflare): If running behind Cloudflare or an external NGINX gateway, ensure WebSocket upgrading (Upgrade $http_upgrade, Connection "upgrade") is enabled and that SSL mode is set to “Full (Strict)”.

Because ~/bruhi-cloud is a standalone configuration folder, updates do not use git pull. Follow this procedure:

  1. Back Up Current Database

    Terminal window
    docker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db ".backup '/app/data/pre-update-backup.db'"
    docker compose cp bruhi-cloud:/app/data/pre-update-backup.db ./pre-update-backup.db
  2. Pull the Latest Images

    Terminal window
    docker compose pull
  3. Recreate Containers with Auto-Migration

    Terminal window
    docker compose up -d

    SQLite schema migrations apply automatically during container startup.

  4. Verify Post-Update Health

    Terminal window
    docker compose ps
    curl -f http://localhost:8000/healthz
    docker compose logs --tail=50 bruhi-cloud

If a release needs to be rolled back:

  1. Stop the current stack:
    Terminal window
    docker compose down
  2. Pin the desired previous image in .env or docker-compose.yml:
    image: ghcr.io/bruhi-technologies/bruhi-cloud:v0.22.0
  3. Restore the pre-update database backup if needed:
    Terminal window
    docker compose run --rm -v bruhi-cloud_bruhi_db:/data alpine cp /data/pre-update-backup.db /data/bruhi.db
  4. Restart the stack:
    Terminal window
    docker compose up -d

brūhi Cloud stores all station settings, accounts, rotation rules, and schedules in a single SQLite database running in WAL mode at /app/data/bruhi.db.

Perform a non-blocking hot backup using SQLite’s online vacuum:

Terminal window
docker compose exec bruhi-cloud sqlite3 /app/data/bruhi.db ".backup '/app/data/backup-$(date +%F).db'"
docker compose cp bruhi-cloud:/app/data/backup-$(date +%F).db ~/backups/

To back up uploaded audio tracks and the SQLite database together:

Terminal window
docker run --rm \
-v bruhi-cloud_bruhi_db:/db:ro \
-v bruhi-cloud_bruhi_audio:/audio:ro \
-v ~/backups:/backup \
alpine tar -czf /backup/bruhi-full-backup-$(date +%F).tar.gz -C / db audio

Key variables read from .env by docker-compose.yml and the server:

VariableDefaultDescription
DOMAINlocalhostPublic domain name. Caddy uses this for Let’s Encrypt certificates.
BRUHI_URLhttps://${DOMAIN}Base URL used for email reset links and passkey authentication.
BRUHI_RP_ID${DOMAIN}WebAuthn Relying Party ID. Must match your public hostname.
BRUHI_RP_NAMEbrūhi CloudRelying party display name shown on biometric prompts.
PORT8000Local port binding for the FastAPI service container.
BRUHI_ENVdevelopmentSet to production in live environments for cookie and CORS security.
LOG_LEVELinfoLog verbosity (debug, info, warning, error).
CORS_ORIGINS""Space-separated list of allowed CORS origins.
BRUHI_DB/app/data/bruhi.dbConsolidated SQLite database path inside container.
AUDIO_DIR/app/audio_filesDirectory where uploaded tracks and recordings reside.
HLS_DIR/hlsMounted to the tmpfs volume for low-latency live segments.
BRUHI_AUDIO_APIhttp://localhost:7700Control-plane address for the internal bruhi-audio engine.