mirror of
https://github.com/jmcorgan/fips.git
synced 2026-07-30 19:46:15 +00:00
Docker testing infrastructure: - Add iperf3 bandwidth testing (10s duration, 8 parallel streams) - Install iperf3 in container, auto-start as daemon alongside FIPS - Support --live flag for real-time iperf3 output during tests - Aggregate [SUM] bandwidth reporting with correct units Configuration templating system: - Single node.template.yaml replacing per-node hand-written configs - Topology definitions in configs/topologies/ (mesh.yaml, chain.yaml) - generate-configs.sh script for automatic config generation - Integrated into build.sh for regeneration on build - Generated configs in generated-configs/ (gitignored) Ping test improvements: - Reduce to 1 ping per test for faster execution (~10s vs ~30s) - Show response times (RTT) for each test - Add Ctrl+C trap for clean exit - Reduce convergence wait from 5s to 3s
60 lines
2.0 KiB
Bash
Executable File
60 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build the FIPS binary and copy it to the docker build context.
|
|
# Supports cross-compilation from macOS to Linux using cargo-zigbuild.
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
DOCKER_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
# Find project root (directory containing Cargo.toml)
|
|
PROJECT_ROOT="$(cd "$DOCKER_DIR/../.." && pwd)"
|
|
if [ ! -f "$PROJECT_ROOT/Cargo.toml" ]; then
|
|
echo "Error: Cannot find Cargo.toml at $PROJECT_ROOT" >&2
|
|
echo "Expected layout: <project-root>/examples/docker-network/scripts/build.sh" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Detect host OS
|
|
UNAME_S=$(uname -s)
|
|
CARGO_TARGET="x86_64-unknown-linux-musl"
|
|
|
|
# Check for cross-compilation tooling on macOS
|
|
if [ "$UNAME_S" = "Darwin" ]; then
|
|
echo "Detected macOS host - using cross-compilation for Linux..."
|
|
|
|
# Check if cargo-zigbuild is installed
|
|
if ! command -v cargo-zigbuild &> /dev/null; then
|
|
echo "Error: cargo-zigbuild not found." >&2
|
|
echo "Please install it: cargo install cargo-zigbuild" >&2
|
|
echo "" >&2
|
|
echo "Or install zig directly: brew install zig" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Check if target is installed
|
|
if ! rustup target list --installed | grep -q "$CARGO_TARGET"; then
|
|
echo "Installing Rust target $CARGO_TARGET..."
|
|
rustup target add "$CARGO_TARGET"
|
|
fi
|
|
|
|
echo "Building FIPS for Linux (release) using cargo-zigbuild..."
|
|
cargo zigbuild --release --target "$CARGO_TARGET" --manifest-path="$PROJECT_ROOT/Cargo.toml"
|
|
|
|
echo "Copying binary to docker context..."
|
|
cp "$PROJECT_ROOT/target/$CARGO_TARGET/release/fips" "$DOCKER_DIR/fips"
|
|
else
|
|
# Native Linux build
|
|
echo "Building FIPS (release)..."
|
|
cargo build --release --manifest-path="$PROJECT_ROOT/Cargo.toml"
|
|
|
|
echo "Copying binary to docker context..."
|
|
cp "$PROJECT_ROOT/target/release/fips" "$DOCKER_DIR/fips"
|
|
fi
|
|
|
|
echo "Done. Binary at $DOCKER_DIR/fips"
|
|
echo ""
|
|
echo "Generating node configurations from templates..."
|
|
"$SCRIPT_DIR/generate-configs.sh" all
|
|
echo ""
|
|
echo "Next: cd $DOCKER_DIR && docker compose --profile mesh build"
|