osrs-data-hub

Quick start

Run a hub for your guild on one machine with Docker Compose.

This sets up a production hub on one VM: PostgreSQL with TimescaleDB, the web app and a background worker, all through Docker Compose. You bring the reverse proxy that terminates HTTPS.

What you need

  • A Linux VM with Docker and the Compose plugin. The database tunes itself for DB_MEMORY (default 2GB), so leave it at least that much memory next to the web app and worker.
  • A domain name for the hub, for example hub.example.com, served over HTTPS by a reverse proxy (Caddy, nginx, Traefik…). See Reverse proxy.
  • A Discord application and bot for sign-in. See Discord setup.
  • The Discord user id of at least one person who will be admin.

Install

Get the code

git clone https://github.com/RedFirebreak/osrs-data-hub.git
cd osrs-data-hub

Configure

cp .env.example .env

At a minimum, fill in:

VariableValue
APP_URLThe public origin, such as https://hub.example.com. It must include https:// and have no path.
POSTGRES_PASSWORDA strong password. Put the same one in DATABASE_URL.
AUTH_SECRETThe output of openssl rand -base64 32.
DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRETFrom your Discord application.
DISCORD_BOT_TOKEN, DISCORD_GUILD_ID, DISCORD_GUILD_NAMEYour bot and your guild.
ADMIN_DISCORD_USER_IDSComma-separated Discord user ids of the first admins.

Every other setting has a default. See Configuration for all of them.

Start

docker compose up -d --build
docker compose logs -f web worker

The one-shot migrate service runs first. web and worker start once it succeeded.

  • The web app listens on 127.0.0.1:3000. Change the port with WEB_PORT.
  • The worker's metrics endpoint listens on 127.0.0.1:9464.

Put it behind HTTPS

Point your reverse proxy at 127.0.0.1:3000. The hub needs a few specific proxy settings, such as no buffering of the live stream and no redirects on the plugin endpoints. Read Reverse proxy before you go live.

Sign in and pair

Open https://hub.example.com, sign in with Discord, and open Add device. The wizard walks you through connecting RuneLite. Share the hub URL with your guild so they can do the same.

Check it's healthy

GET /api/health answers {"ok":true} when the web app can reach the database, and 503 when it can't. Use it for your uptime monitor.

Updating

git pull && docker compose up -d --build

A short outage during a deploy is safe. While the web app restarts, the plugin backs off, queues its events for up to 10 minutes and resends them. The hub ignores duplicates by event id.

Trying it locally

To poke at the hub on your own machine, run the development setup from the hub's README:

corepack enable && pnpm install
docker compose -f compose.dev.yaml up -d
cp .env.example .env   # DATABASE_URL=postgres://hub:hub@127.0.0.1:5432/hub and the Discord values
pnpm db:migrate && pnpm dev

On this page