Skip to content

Railway

Railway builds the collector from the repository using deploy/railway.json and gives you HTTPS on a *.up.railway.app domain or your own.

  1. Create a project from the repository

    In Railway, choose New project → Deploy from GitHub repo and pick your fork of Shardlens. In the service’s Settings → Config-as-code, set the config file to /deploy/railway.json. Railway then builds apps/collector/Dockerfile and checks /readyz before switching traffic.

  2. Add PostgreSQL

    New → Database → PostgreSQL in the same project.

  3. Generate a domain under the service’s Settings → Networking. The collector needs its own address in the next step.

  4. Set the variables on the collector service

    Variable Value
    DATABASE_URL ${{Postgres.DATABASE_URL}}
    SHARDLENS_PUBLIC_URL https://${{RAILWAY_PUBLIC_DOMAIN}}
    SHARDLENS_APP_ID Your Discord application ID
    SHARDLENS_SESSION_SECRET openssl rand -base64 32
    SHARDLENS_SETTINGS_KEY openssl rand -base64 32
    SHARDLENS_INGEST_KEY npx shardlens keys --scope ingest
    SHARDLENS_READ_KEY npx shardlens keys --scope read
    SHARDLENS_TRUST_PROXY 1

    ${{RAILWAY_PUBLIC_DOMAIN}} is the *.up.railway.app domain from step 3. With your own domain, write its URL instead. Railway sets PORT, and the collector listens on it. The optional variables are in the environment reference.

  5. Deploy, then open the domain.