nodebench

Run your own share server

The server is one Go binary. Results are stored as plain JSON files, there's no database to run next to it.

  1. Build it

    $ git clone https://github.com/instantnode/nodebench
    $ cd nodebench/server
    $ go build -o nodebench-server .
  2. Start it

    $ ./nodebench-server -base https://bench.example.com \
        -data /var/lib/nodebench -script ../nodebench.sh

    A systemd unit and an nginx config are in deploy/. Put it behind a reverse proxy for TLS and start it with -proxy so the upload limit sees real client addresses.

  3. Point the script at it

    $ curl -sL https://bench.example.com | NODEBENCH_URL=https://bench.example.com bash

    The server hands out the script itself when it's fetched with curl or wget, so the one-liner works against your host too.

FlagEnvDefault
-listenNODEBENCH_LISTEN:8080listen address
-baseNODEBENCH_BASEhttp://localhost:8080public url used in share links
-dataNODEBENCH_DATA./datawhere results are stored
-scriptNODEBENCH_SCRIPT../nodebench.shserved to curl and wget on /
-proxyNODEBENCH_PROXYofftrust X-Forwarded-For, only behind a proxy
-rate20uploads per IP per hour
-exampleNODEBENCH_EXAMPLEresult shown on the home page
NODEBENCH_ADMIN_TOKENenables hiding results from the leaderboard

Moderating the leaderboard

With an admin token set, this takes a result off the leaderboard. The result page itself stays online.

$ curl -X POST -H "Authorization: Bearer $TOKEN" \
    https://bench.example.com/api/results/<id>/hide

Storage

One small JSON file per result, sharded into folders by the first two characters of the id. Back up the data directory and you have everything, including the list of hidden results.