Running your own share server

The server is one Go binary. Results are stored as JSON files in a directory, there's no database.

Build and start

$ git clone https://github.com/instantnodeeu/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. The nginx config turns the access log off, because the pages say IP addresses aren't logged.

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. PowerShell gets nodebench.ps1 from the same directory as the script:

PS> $env:NODEBENCH_URL = "https://bench.example.com"; irm https://bench.example.com | iex

Settings

-listen
listen address, default :8080 (NODEBENCH_LISTEN)
-base
public URL used in share links (NODEBENCH_BASE)
-data
where results are stored, default ./data (NODEBENCH_DATA)
-script
the script served to curl and wget on /, nodebench.ps1 next to it goes to PowerShell (NODEBENCH_SCRIPT)
-proxy
trust X-Forwarded-For, only behind a proxy (NODEBENCH_PROXY)
-rate
uploads per IP per hour, default 20
-example
a result id to link from the home page (NODEBENCH_EXAMPLE)
NODEBENCH_ADMIN_TOKEN
enables taking results off the leaderboard

Moderation

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

This takes a result off the leaderboard. The result page itself stays online. Hidden ids are kept in hidden.txt in the data directory, so a backup of that directory is a backup of everything.