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
The server is one Go binary. Results are stored as plain JSON files, there's no database to run next to it.
$ git clone https://github.com/instantnode/nodebench $ cd nodebench/server $ go build -o nodebench-server .
$ ./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.
$ 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.
| Flag | Env | Default | |
|---|---|---|---|
| -listen | NODEBENCH_LISTEN | :8080 | listen address |
| -base | NODEBENCH_BASE | http://localhost:8080 | public url used in share links |
| -data | NODEBENCH_DATA | ./data | where results are stored |
| -script | NODEBENCH_SCRIPT | ../nodebench.sh | served to curl and wget on / |
| -proxy | NODEBENCH_PROXY | off | trust X-Forwarded-For, only behind a proxy |
| -rate | 20 | uploads per IP per hour | |
| -example | NODEBENCH_EXAMPLE | result shown on the home page | |
| NODEBENCH_ADMIN_TOKEN | enables hiding results from 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
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.