Files
s3/test/kafka/scripts/test-broker-startup.sh
zooqueen dd74d3e6d6 Replace AGPL MinIO fork with Apache-2.0 SeaweedFS fork; rebrand CLI weed->s3
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.

- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
  "Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
  SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
  (replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
  keep their upstream import paths with zero churn. Internal identifiers and
  import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
  help/usage/flag strings, shell autocomplete program name, and the product name
  in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
  (e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
  `cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
  updated to ignore the `s3` build output.
2026-06-18 23:41:25 -07:00

112 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Script to test SeaweedFS MQ broker startup locally
# This helps debug broker startup issues before running CI
set -e
echo "=== Testing SeaweedFS MQ Broker Startup ==="
# Build weed binary
echo "Building weed binary..."
cd "$(dirname "$0")/../../.."
go build -o /tmp/weed ./weed
# Setup data directory
WEED_DATA_DIR="/tmp/seaweedfs-broker-test-$$"
mkdir -p "$WEED_DATA_DIR"
echo "Using data directory: $WEED_DATA_DIR"
# Cleanup function
cleanup() {
echo "Cleaning up..."
pkill -f "weed.*server" || true
pkill -f "weed.*mq.broker" || true
sleep 2
rm -rf "$WEED_DATA_DIR"
rm -f /tmp/weed-*.log
}
trap cleanup EXIT
# Start SeaweedFS server
echo "Starting SeaweedFS server..."
/tmp/weed -v 1 server \
-ip="127.0.0.1" \
-ip.bind="0.0.0.0" \
-dir="$WEED_DATA_DIR" \
-master.raftHashicorp \
-master.port=9333 \
-volume.port=8081 \
-filer.port=8888 \
-filer=true \
-metricsPort=9325 \
> /tmp/weed-server-test.log 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"
# Wait for master
echo "Waiting for master..."
for i in $(seq 1 30); do
if curl -s http://127.0.0.1:9333/cluster/status >/dev/null; then
echo "✓ Master is up"
break
fi
echo " Waiting for master... ($i/30)"
sleep 1
done
# Wait for filer
echo "Waiting for filer..."
for i in $(seq 1 30); do
if nc -z 127.0.0.1 8888; then
echo "✓ Filer is up"
break
fi
echo " Waiting for filer... ($i/30)"
sleep 1
done
# Start MQ broker
echo "Starting MQ broker..."
/tmp/weed -v 2 mq.broker \
-master="127.0.0.1:9333" \
-ip="127.0.0.1" \
-port=17777 \
> /tmp/weed-mq-broker-test.log 2>&1 &
BROKER_PID=$!
echo "Broker PID: $BROKER_PID"
# Wait for broker
echo "Waiting for broker..."
broker_ready=false
for i in $(seq 1 30); do
if nc -z 127.0.0.1 17777; then
echo "✓ MQ broker is up"
broker_ready=true
break
fi
echo " Waiting for MQ broker... ($i/30)"
sleep 1
done
if [ "$broker_ready" = false ]; then
echo "❌ MQ broker failed to start"
echo
echo "=== Server logs ==="
cat /tmp/weed-server-test.log
echo
echo "=== Broker logs ==="
cat /tmp/weed-mq-broker-test.log
exit 1
fi
# Broker started successfully - discovery will be tested by Kafka gateway
echo "✓ Broker started successfully and accepting connections"
echo
echo "[OK] All tests passed!"
echo "Server logs: /tmp/weed-server-test.log"
echo "Broker logs: /tmp/weed-mq-broker-test.log"