mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
deploy/testnet: one-command-per-box bring-up for a fleet of standalone `dexd run` venues across two boxes, a cross-arch determinism proof, and a ZAP load/throughput bench (drives the existing cmd/dexbench). - compose.yml + gen-compose.sh: N independent venues/box (default 3, scales to ~11), one ZAP port/node, per-node data dirs, 128GB-box resource caps. - Dockerfile: pure-Go CPU image (dexd + dexbench), native amd64/arm64. - Makefile: make up/bench/verify/down — git pull + one command per box. - topology.md: honest consensus model (independent venues, deterministic per-node genesis, no gossip) + the luxd `dexd plugin` BFT path. - overlay/: opt-in hanzozt (OpenZiti) tunneler for NAT; direct 2.5GbE is the default for true wire numbers. - README.md: exact per-box commands, 128GB sizing, reading bench output. Validated locally: signed place/cross load 0 rejects (cross=1 fill/submit); dexbench -verify across two independent venues PASS (byte-identical 3-fill multi-level sweep).
66 lines
3.3 KiB
Docker
66 lines
3.3 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# ---------------------------------------------------------------------------
|
|
# dexd-testnet — the multi-node testnet image (CPU, pure-Go, native arch).
|
|
#
|
|
# Builds BOTH binaries the testnet needs from this repo:
|
|
# /usr/local/bin/dexd — the D-Chain venue (cmd/dexd, `dexd run`)
|
|
# /usr/local/bin/dexbench — the signed-ZAP load-gen + cross-arch determinism
|
|
# checker (cmd/dexbench)
|
|
#
|
|
# CGO_ENABLED=0 → pkg/lx's pure-Go CPU matcher (the !cgo build tag). No CUDA, no
|
|
# MLX — so this ONE image builds and runs natively on BOTH boxes:
|
|
# evo = linux/amd64 (WSL) spark = linux/arm64
|
|
# The build does NOT cross-compile: GOARCH defaults to the build host's arch, so
|
|
# `docker build` on each box yields that box's native image. The ZAP wire is a
|
|
# frozen big-endian codec (pkg/zapwire), byte-identical on amd64⇄arm64, which is
|
|
# what makes the cross-arch venue fleet sound (prove it with `dexbench -verify`).
|
|
#
|
|
# GPU NOTE: the GPU matcher (CGO_ENABLED=1) is arm64+CUDA only and lives in
|
|
# Dockerfile.dvenue (spark only, needs the private luxcpp dep tarball). The CPU
|
|
# image here is the canonical, portable testnet path; see README.md "GPU".
|
|
# ---------------------------------------------------------------------------
|
|
ARG GO_VERSION=1.26.4
|
|
FROM golang:${GO_VERSION}-bookworm AS builder
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
git ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
# luxfi/* (and hanzoai/*) modules are private; resolve them over HTTPS with a
|
|
# BuildKit secret (pass with: docker build --secret id=gh_token,env=GH_TOKEN ...).
|
|
# Public testnet code builds fine WITHOUT a token if the module cache/proxy already
|
|
# has the luxfi deps; the secret is only needed for a cold private fetch.
|
|
ENV GOPRIVATE=github.com/luxfi/*,github.com/hanzoai/*
|
|
ENV GOFLAGS=-mod=mod
|
|
ENV GOTOOLCHAIN=auto
|
|
ENV GOEXPERIMENT=jsonv2
|
|
|
|
WORKDIR /app
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=secret,id=gh_token,required=false \
|
|
if [ -s /run/secrets/gh_token ]; then \
|
|
git config --global url."https://x-access-token:$(cat /run/secrets/gh_token)@github.com/".insteadOf "https://github.com/"; \
|
|
fi && \
|
|
go mod download
|
|
COPY . .
|
|
|
|
# Build both binaries pure-Go, native arch (no GOOS/GOARCH override).
|
|
RUN --mount=type=secret,id=gh_token,required=false \
|
|
if [ -s /run/secrets/gh_token ]; then \
|
|
git config --global url."https://x-access-token:$(cat /run/secrets/gh_token)@github.com/".insteadOf "https://github.com/"; \
|
|
fi && \
|
|
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/dexd ./cmd/dexd && \
|
|
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/dexbench ./cmd/dexbench
|
|
|
|
FROM debian:12-slim AS execution
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates netcat-openbsd && rm -rf /var/lib/apt/lists/* \
|
|
&& groupadd -g 1000 dexd && useradd -u 1000 -g dexd -m -s /usr/sbin/nologin dexd \
|
|
&& mkdir -p /data && chown -R dexd:dexd /data
|
|
COPY --from=builder /out/dexd /usr/local/bin/dexd
|
|
COPY --from=builder /out/dexbench /usr/local/bin/dexbench
|
|
USER dexd
|
|
EXPOSE 9099
|
|
# Default: standalone venue on all interfaces. The compose overrides -db per node.
|
|
ENTRYPOINT ["/usr/local/bin/dexd"]
|
|
CMD ["run", "-addr", "0.0.0.0:9099", "-db", "/data/db"]
|