Deployment modes
The repository contains several ways to run the same gateway and witness-node binaries. They are examples and deployment assets, not a security-reviewed production topology.
Bare metal or VM
The gateway can run under systemd as a dedicated witness user. A typical
topology is:
Internet -- TLS --> nginx / load balancer -- HTTP --> 127.0.0.1:8080 gateway
|
HTTPS/HTTP dev only
v
signing servers
The gateway speaks plain HTTP and does not terminate TLS. The repository's
nginx template terminates TLS and applies per-route IP allowlists. In
particular, signer /v1/sign and /add-checkpoint should be restricted to
trusted gateways. The first uses bearer authentication; the second checks
the log signature.
When a proxy is trusted, pass its CIDR with --trusted-proxy or
WITNESS_TRUSTED_PROXIES. Forwarded addresses are used only when the immediate
peer matches one of those CIDRs; otherwise the gateway uses the socket peer.
The gateway database must be on persistent local disk, not a network filesystem. Keep configuration and credentials access-controlled. Give each signer a persistent writable directory for its checkpoint state file. See operator documentation for service examples.
Docker images
The root Dockerfile has multi-stage targets:
witness-node, a non-root runtime exposing port 3000 and reading a mounted node configuration; andwitness-gateway, a non-root runtime exposing port 8080 and including the gateway, CLI, and auditor binaries.
The gateway image uses /data for configuration and SQLite state. Mount the
configuration read-only where possible and give the database a persistent
local volume. Do not expose the plain HTTP container port directly to an
untrusted network; put TLS and route restrictions in front of it.
The Docker build disables LTO and uses multiple codegen units to reduce build resource use. This differs from the root Cargo release profile and should not be assumed to produce byte-identical local release artifacts.
Compose example
docker-compose.yaml provides a three-signer example. Each signer keeps
its key and checkpoint state on its own volume. A setup service reads
per-signer registration data (public keys and bearer tokens, not private
keys) and writes the gateway's network.json. The gateway uses a separate
persistent SQLite volume. Use docker-compose.build.yaml as an override to
build local images rather than pulling them.
Protect the generated configs, registration data, and state volumes. Separate mounts isolate signer keys from peer containers, not from an administrator of the Docker host.
Repository examples
The shell examples follow a setup, start, demo, stop lifecycle:
- the standard example runs three Ed25519 witnesses with threshold two, witnesses on ports 3001-3003, and a gateway on 8080;
- the gateway variants run multiple independent networks for local exercises.
These examples are useful for testing threshold failures, signer outages, and duplicate hashes. They use local HTTP and generated secrets and are not production defaults.
Auditor placement
The auditor can run separately on a monitoring host or under cron/systemd. It
needs an independent public-key pin, network access to the gateway's log and
key history endpoints, and its own persistent SQLite database. A watch process
continuously checks new checkpoints; check can be
run as a periodic one-shot. Keeping the auditor's database outside the
gateway's host gives its rollback memory a more independent failure domain.
Availability and scaling caveats
The durable job lease permits multiple gateway processes to claim distinct jobs in the storage model, but operators must not run multiple independent gateway processes against the same SQLite file. SQLite's local-disk and single-writer constraints remain. Horizontal deployments need an explicitly designed storage and routing topology rather than simply sharing a network filesystem.