clone

a self-hosted multitenant nostr relay with sites, file storage, git hosting, and inbox and outbox delivery

generalize the Linux test host

Dami committed 4eb2c99
Name the remote Docker host through LINUX_HOST instead of a fixed machine
name, keep test checkouts under the remote home directory, and rename the
scripts, Makefile target, artifact directory and deployment module to
match.
commit
4eb2c99fd6cc23a5da8e2876035ad397dbe63151
parent
71d8d53c8edfe93a18ed8a9bd41fa775f437858a
author
Dami <dami.etoile@gmail.com>
8 files changed, +35 -35
MMakefile6+++---
MREADME.md4++--
Rdeploy/slate-tiny.nix → deploy/tiny-host.nix0
Mdocs/personal-relay.md12++++++------
Mdocs/testing.md16++++++++--------
Minternal/daemon/creation_test.go4++--
Rscripts/bench-slate.sh → scripts/bench-linux.sh10+++++-----
Rscripts/test-slate.sh → scripts/test-linux.sh18+++++++++---------
M Makefile +3 -3
M README.md +2 -2
R deploy/slate-tiny.nix → deploy/tiny-host.nix +0 -0

No content changes.

M docs/personal-relay.md +6 -6
M docs/testing.md +8 -8
@@ -1,4 +1,4 @@
1-# Testing and the Linux slate1+# Testing and the Linux host22 33 The normal development loop is local:44
@@ -9,17 +9,17 @@ make test
99 1010 The repository also contains a multistage Docker build. `make docker-test` runs `TEST_PACKAGES` (default `./...`) under Go 1.27.1 on Debian Bookworm with the race detector. `make docker-build` builds the self-hosted runtime image.1111 12-## Remote slate12+## Remote Linux host1313 14-`scripts/test-slate.sh` runs the same internal race test in an isolated Docker build on the configured Linux host. It synchronizes the exact worktree, including untracked files, over SSH into a unique directory under `/home/tank/tinyrelay-tests/`; it never runs global Docker cleanup and never edits host configuration.14+`scripts/test-linux.sh` runs the same internal race test in an isolated Docker build on the configured Linux host. It synchronizes the exact worktree, including untracked files, over SSH into a unique directory under `~/tinyrelay-tests/` in the remote home directory; it never runs global Docker cleanup and never edits host configuration.1515 1616 ```sh17-SLATE_HOST=slate SLATE_NAME=tinyrelay-review-1 ./scripts/test-slate.sh17+LINUX_HOST=<host> LINUX_NAME=tinyrelay-review-1 ./scripts/test-linux.sh1818 ```1919 20-Useful overrides are `SLATE_PACKAGES` (the default internal package list) and `SLATE_ARTIFACTS` (local artifact destination). The script records UTC time, host, kernel, CPU count, Docker server version, Go version, target platform, and SQLite module version beside the Docker build log, including a status file when the build fails. A unique `SLATE_NAME` is required when multiple runs share a slate host.20+Useful overrides are `LINUX_PACKAGES` (the default internal package list) and `LINUX_ARTIFACTS` (local artifact destination). The script records UTC time, host, kernel, CPU count, Docker server version, Go version, target platform, and SQLite module version beside the Docker build log, including a status file when the build fails. A unique `LINUX_NAME` is required when multiple runs share a host.2121 22-To run the complete tree on Linux, set `SLATE_PACKAGES='./...'`.22+To run the complete tree on Linux, set `LINUX_PACKAGES='./...'`.2323 2424 The runtime image is a small Debian image containing the static Go binary, `ca-certificates`, and `git`. It runs as UID 10001 (`relay`) with `/data` as the writable volume. Bind the relay and diagnostics listeners explicitly; diagnostics should stay on loopback or a protected Tailscale address and must not be published publicly.2525
@@ -29,10 +29,10 @@ The checked-in benchmarks provide a repeatable first baseline without claiming a
2929 3030 ```sh3131 make benchmark32-SLATE_HOST=slate ./scripts/bench-slate.sh32+LINUX_HOST=<host> ./scripts/bench-linux.sh3333 ```3434 35-`BenchmarkSave`, `BenchmarkQuery`, and `BenchmarkTextSearch` use a local SQLite WAL store with representative seeded events. `BenchmarkFanout` measures only the in-memory broadcast and enqueue path to 10, 100, and 1,000 subscribed clients; it excludes websocket network writes and client-reader scheduling. The slate script records the Linux host, CPU count, Docker/Go/SQLite versions, benchmark output, and exit status under `artifacts/bench/`; use `BENCH_PACKAGES` and `BENCHTIME` for controlled comparisons. Treat these as baselines until a workload and hardware matrix supports a capacity claim.35+`BenchmarkSave`, `BenchmarkQuery`, and `BenchmarkTextSearch` use a local SQLite WAL store with representative seeded events. `BenchmarkFanout` measures only the in-memory broadcast and enqueue path to 10, 100, and 1,000 subscribed clients; it excludes websocket network writes and client-reader scheduling. The benchmark script records the Linux host, CPU count, Docker/Go/SQLite versions, benchmark output, and exit status under `artifacts/bench/`; use `BENCH_PACKAGES` and `BENCHTIME` for controlled comparisons. Treat these as baselines until a workload and hardware matrix supports a capacity claim.3636 3737 For Git workloads that include child processes inside Docker, `scripts/observe-git-benchmark.py` captures the benchmark output, host load/memory, and Docker cgroup v2 CPU, memory, I/O, and PID samples every 500ms. It also snapshots authenticated `/metrics`, heap, and goroutine profiles before and after the run. The optional `--cpu-profile` captures one bounded 60-second Go CPU profile; cgroup samples remain the source for child CPU accounting.3838
M internal/daemon/creation_test.go +2 -2
R scripts/bench-slate.sh → scripts/bench-linux.sh +5 -5
R scripts/test-slate.sh → scripts/test-linux.sh +9 -9
@@ -1,18 +1,18 @@
11 #!/usr/bin/env bash22 set -euo pipefail33 4-remote_host="${SLATE_HOST:-slate}"5-name="${SLATE_NAME:-tinyrelay-${USER:-user}-$$}"4+remote_host="${LINUX_HOST:?set LINUX_HOST to the SSH name of the Linux Docker host}"5+name="${LINUX_NAME:-tinyrelay-${USER:-user}-$$}"66 safe_name="$(printf '%s' "$name" | tr -cs 'A-Za-z0-9_.-' '-' | sed 's/^-*//;s/-*$//')"77 if [[ -z "$safe_name" ]]; then8- echo "invalid empty SLATE_NAME" >&28+ echo "invalid empty LINUX_NAME" >&299 exit 21010 fi11-remote_root="/home/tank/tinyrelay-tests/${safe_name}"12-image="tinyrelay-slate-${safe_name}"13-packages="${SLATE_PACKAGES:-./internal/auth ./internal/blob ./internal/catalog ./internal/policy ./internal/relay ./internal/replication ./internal/storage ./internal/syncprotocol ./internal/telemetry ./internal/templates ./internal/work}"11+remote_root="tinyrelay-tests/${safe_name}"12+image="tinyrelay-linux-${safe_name}"13+packages="${LINUX_PACKAGES:-./internal/auth ./internal/blob ./internal/catalog ./internal/policy ./internal/relay ./internal/replication ./internal/storage ./internal/syncprotocol ./internal/telemetry ./internal/templates ./internal/work}"1414 stamp="$(date -u +%Y%m%dT%H%M%SZ)"15-local_artifacts="${SLATE_ARTIFACTS:-artifacts/slate/${safe_name}/${stamp}}"15+local_artifacts="${LINUX_ARTIFACTS:-artifacts/linux/${safe_name}/${stamp}}"1616 mkdir -p "$local_artifacts"1717 packages_b64="$(printf '%s' "$packages" | base64 | tr -d '\n')"1818
@@ -29,12 +29,12 @@ COPYFILE_DISABLE=1 tar \
2929 3030 echo "running Linux race tests in ${image}"3131 set +e32-ssh "$remote_host" "SLATE_PACKAGES_B64='$packages_b64' sh -s -- '$remote_root' '$image' '$stamp'" <<'REMOTE'32+ssh "$remote_host" "LINUX_PACKAGES_B64='$packages_b64' sh -s -- '$remote_root' '$image' '$stamp'" <<'REMOTE'3333 set -eu3434 remote_root=$13535 image=$23636 stamp=$337-packages=$(printf '%s' "$SLATE_PACKAGES_B64" | base64 -d)37+packages=$(printf '%s' "$LINUX_PACKAGES_B64" | base64 -d)3838 artifact_dir="$remote_root/artifacts/$stamp"3939 mkdir -p "$artifact_dir"4040 {