How to stand up OffStack's enterprise cluster fabric across 2–3 real machines and prove it works — read the automated preflight, run the full verification drill, and do the manual kill-one-node failover.
The fabric is three independent node types over one shared SQL database:
| node | role | default port | class |
|---|---|---|---|
blob-node | chunk storage (object payloads) | 7100 | BlobNodeServer |
worker | remote Python compute | 7200 | ComputeWorkerServer |
| gateway | the normal OffStack services | 4566 | start.py --unified-port |
Object manifests (which nodes hold which chunk) and the node/worker registries live in the shared SQL database; chunks live on the blob nodes' disks. A gateway replica pointed at the same DB + node list reads and writes one object space with no per-host filesystem.
1. Prerequisites (every machine)
- A shared, reachable database on the LAN — PostgreSQL 16, MySQL 8.4,
MariaDB, SQL Server, Oracle, CockroachDB, Dolt, DuckDB, Firebird, IBM Db2 12.1.6, SAP HANA 2.0 SPS08, or SQLite — and one SQLAlchemy URL every host uses, e.g. postgresql+psycopg://offstack:pw@192.168.1.10:5432/offstack. A shared network SQLite file is not recommended for real load; use a server engine (or a single SQLite path on one host for the local harness).
- Clock sync within 300 s across hosts (NTP). Preflight measures
|local - server_time| from each node's /healthz.
- Firewall open for the DB port (
5432/3306), blob nodes (7100),
workers (7200), and the gateway (4566).
- A strong shared secret. Every node needs the same HMAC secret; a
non-loopback bind refuses to start without one. Generate one:
# Linux / macOS
python -c "import secrets; print(secrets.token_urlsafe(48))"
# Windows PowerShell
python -c "import secrets; print(secrets.token_urlsafe(48))"
- A Python environment with OffStack's dependencies, and the repo on each host
(or an installed OffStack; offstack cluster / python start.py cluster / python -m cluster.cli must run).
2. Start the nodes
Pick H1, H2 = each host's LAN IP (not 127.0.0.1). Binding 0.0.0.0 requires --advertise-url so the node registers a reachable URL, never http://0.0.0.0:....
Set the shared values once per shell:
# Linux / macOS
export DB="postgresql+psycopg://offstack:pw@192.168.1.10:5432/offstack"
export SECRET="<the strong secret>"
export H1="192.168.1.11" # this host's LAN IP
# Windows PowerShell
$env:DB = "postgresql+psycopg://offstack:pw@192.168.1.10:5432/offstack"
$env:SECRET = "<the strong secret>"
$env:H1 = "192.168.1.11"
Host 1 — database host, one blob node, one worker
python -m cluster.cli --state-file "$DB" --shared-secret "$SECRET" \
blob-node --host 0.0.0.0 --port 7100 \
--advertise-url "http://$H1:7100" \
--data-dir ./cluster_blobs_h1 --register
python -m cluster.cli --state-file "$DB" --shared-secret "$SECRET" \
worker --host 0.0.0.0 --port 7200 \
--advertise-url "http://$H1:7200" \
--heartbeat-interval 5
python -m cluster.cli --state-file $env:DB --shared-secret $env:SECRET `
blob-node --host 0.0.0.0 --port 7100 `
--advertise-url "http://$($env:H1):7100" `
--data-dir .\cluster_blobs_h1 --register
python -m cluster.cli --state-file $env:DB --shared-secret $env:SECRET `
worker --host 0.0.0.0 --port 7200 `
--advertise-url "http://$($env:H1):7200" `
--heartbeat-interval 5
Host 2 — a second blob node and worker
Same commands on H2, with --advertise-url "http://$H2:7100" / "...:7200" and its own --data-dir.
Optional Host 3 / gateway
python start.py --unified-port 4566 --persist --state-file "$DB" \
--shared-... # the normal gateway; blob_store = ClusterBlobStore over the node list
Every node prints its bound port and advertised URL on startup (blob node on http://H1:7100 (bound port 7100 ...) registered as ...). A --heartbeat-interval (default 5 s) keeps each node's registry row fresh so an idle node never ages out past the 30 s staleness window.
3. Verify
Preflight (fast — DB, reachability, clock skew, HMAC)
python -m cluster.cli preflight --state-file "$DB" --shared-secret "$SECRET" \
--blob-nodes "http://$H1:7100,http://$H2:7100" \
--workers "http://$H1:7200,http://$H2:7200"
Add --json for machine-readable output. Exit 0 = all checks pass; 1 = a check failed (the table says which); 2 = usage error.
Cluster status (read-only)
python -m cluster.cli --state-file "$DB" status --json
Lists registered nodes, live workers and the event-log head.
Full verification drill (turnkey)
python scripts/verify_multihost_cluster.py \
--state-file "$DB" --shared-secret "$SECRET" \
--blob-nodes "http://$H1:7100,http://$H2:7100" \
--workers "http://$H1:7200,http://$H2:7200" \
--replication-factor 2
It runs, in order: preflight → security (unsigned/wrong-secret/replayed requests refused) → replicated blob integrity (PUT, manifest check, GET + SHA-256, delete) → remote compute dispatch (real workers, no local fallback) → cross-node event bus. Exit 0 = full pass.
On Windows LAN hosts, scripts/run_lan_cluster_drill.ps1 wraps these exact cluster.cli, verify_multihost_cluster.py, and Windows Firewall rules per role (-Role coordinator|worker|blob-node|verify; pass -DryRun to preview commands safely without contacting any host).
Manual failover drill
By default the drill pauses and asks you to stop one replica blob node holding the test blob and one worker, then verifies a blob GET still returns the exact bytes from the surviving replica and compute dispatch still succeeds on the survivor. Pass --skip-manual-failover to run only the automated parts (e.g. in CI).
4. What each security check proves
- An unsigned
PUT /chunks/...orPOST /worker/v1/executeis refused
(401) when a secret is set — an open node is never exposed.
- A wrong-secret signature is refused (
403). - A replayed nonce is refused (
403), and a timestamp older than
±300 s is refused (replay protection).
5. Troubleshooting
| symptom | cause / fix |
|---|---|
BlobNodeServer ... needs an explicit advertise_url when bound to a wildcard address | you bound 0.0.0.0 with --register/--advertise-url missing — add --advertise-url http://<LAN-ip>:7100 |
requires a shared_secret unless bound to a loopback address | set --shared-secret on every non-loopback bind |
preflight shows large skew | one host's clock is off — fix NTP |
table ... already exists on simultaneous start | concurrent boot DDL on one SQLite file; the CLI serialises it with a sidecar lock, but for real hosts use a server engine |
| worker disappears after ~30 s idle | --heartbeat-interval 0 disabled the heartbeat — leave it at 5 |
Want a live walkthrough or evaluation setup for Offstack? Message George Vranjesevic or reach out at george@developmentsnapshot.com.