mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
The binary is s3 and the product is Hanzo S3; the rest of the tree now says so too. - Environment: WEED_* and SEAWEEDFS_* are S3_*, no aliases. fla9's flag prefix is S3, matching viper's existing "s3" prefix, so the S3_S3_SSE_* names mini.go exports are the ones viper reads (WEED_S3_SSE_KEK was never seen once viper moved to "s3"). - Java and Hadoop: packages, fs.hanzofs.* keys and the hanzofs:// scheme under the hanzofs namespace the protos already declare; classes take a neutral Filer prefix and file names match them again (the earlier pass left Seas3*.java holding Seaweed* classes). Client, hdfs3, examples, s3copier, random_access and the Spark tests compile. - Helm chart: helpers are hanzo.*, values live under global.s3; the chart renders and lints, which it did not before. - Terraform: the s3.service.tftpl reference matches the file; 12/12 render tests pass. Config paths point at /etc/hanzo, which the binary reads. - loadtest.pb.go regenerated from loadtest.proto. - Upstream logo, sponsor images and unreferenced diagrams removed from note/. Kept: NOTICE attribution, LICENSE, the erasure-coding fixture s3/storage/erasure_coding/1.dat (test bytes), and unmaintained/ and third_party/ (vendored). No on-disk format, wire protocol or metadata key changed. Co-authored-by: Hanzo Dev <[email protected]>
346 lines
15 KiB
Makefile
346 lines
15 KiB
Makefile
# Hanzo Admin Integration Test Makefile
|
|
# Tests the admin server and worker functionality using official s3 commands
|
|
|
|
.PHONY: help build build-and-restart restart-workers start stop restart logs clean status test admin-ui worker-logs master-logs admin-logs vacuum-test vacuum-demo vacuum-status vacuum-data vacuum-data-high vacuum-data-low vacuum-continuous vacuum-clean vacuum-help
|
|
.DEFAULT_GOAL := help
|
|
|
|
COMPOSE_FILE := docker-compose-ec-test.yml
|
|
PROJECT_NAME := admin_integration
|
|
|
|
build: ## Build Hanzo with latest changes and create Docker image
|
|
@echo "๐จ Building Hanzo with latest changes..."
|
|
@echo "1๏ธโฃ Generating admin templates..."
|
|
@cd ../../ && make admin-generate
|
|
@echo "2๏ธโฃ Building Docker image with latest changes..."
|
|
@cd ../ && make build
|
|
@echo "3๏ธโฃ Copying binary for local docker-compose..."
|
|
@cp ../s3 ./s3-local
|
|
@echo "โ
Build complete! Updated image: ghcr.io/hanzoai/s3:local"
|
|
@echo "๐ก Run 'make restart' to apply changes to running services"
|
|
|
|
build-and-restart: build ## Build with latest changes and restart services
|
|
@echo "๐ Recreating services with new image..."
|
|
@echo "1๏ธโฃ Recreating admin server with new image..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d admin
|
|
@sleep 5
|
|
@echo "2๏ธโฃ Recreating workers to reconnect..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d worker1 worker2 worker3
|
|
@echo "โ
All services recreated with latest changes!"
|
|
@echo "๐ Admin UI: http://localhost:23646/"
|
|
@echo "๐ก Workers will reconnect to the new admin server"
|
|
|
|
restart-workers: ## Restart all workers to reconnect to admin server
|
|
@echo "๐ Restarting workers to reconnect to admin server..."
|
|
@docker-compose -f $(COMPOSE_FILE) restart worker1 worker2 worker3
|
|
@echo "โ
Workers restarted and will reconnect to admin server"
|
|
|
|
help: ## Show this help message
|
|
@echo "Hanzo Admin Integration Test"
|
|
@echo "================================"
|
|
@echo "Tests admin server task distribution to workers using official s3 commands"
|
|
@echo ""
|
|
@echo "๐๏ธ Cluster Management:"
|
|
@grep -E '^(start|stop|restart|clean|status|build):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-18s %s\n", $$1, $$2}'
|
|
@echo ""
|
|
@echo "๐งช Testing:"
|
|
@grep -E '^(test|demo|validate|quick-test):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-18s %s\n", $$1, $$2}'
|
|
@echo ""
|
|
@echo "๐๏ธ Vacuum Testing:"
|
|
@grep -E '^vacuum-.*:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-18s %s\n", $$1, $$2}'
|
|
@echo ""
|
|
@echo "๐ Monitoring:"
|
|
@grep -E '^(logs|admin-logs|worker-logs|master-logs|admin-ui):.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-18s %s\n", $$1, $$2}'
|
|
@echo ""
|
|
@echo "๐ Quick Start:"
|
|
@echo " make start # Start cluster"
|
|
@echo " make vacuum-test # Test vacuum tasks"
|
|
@echo " make vacuum-help # Vacuum testing guide"
|
|
@echo ""
|
|
@echo "๐ก For detailed vacuum testing: make vacuum-help"
|
|
|
|
start: ## Start the complete Hanzo cluster with admin and workers
|
|
@echo "๐ Starting Hanzo cluster with admin and workers..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d
|
|
@echo "โ
Cluster started!"
|
|
@echo ""
|
|
@echo "๐ Access points:"
|
|
@echo " โข Admin UI: http://localhost:23646/"
|
|
@echo " โข Master UI: http://localhost:9333/"
|
|
@echo " โข Filer: http://localhost:8888/"
|
|
@echo ""
|
|
@echo "๐ Services starting up..."
|
|
@echo " โข Master server: โ"
|
|
@echo " โข Volume servers: Starting (6 servers)..."
|
|
@echo " โข Filer: Starting..."
|
|
@echo " โข Admin server: Starting..."
|
|
@echo " โข Workers: Starting (3 workers)..."
|
|
@echo ""
|
|
@echo "โณ Use 'make status' to check startup progress"
|
|
@echo "๐ก Use 'make logs' to watch the startup process"
|
|
|
|
start-staged: ## Start services in proper order with delays
|
|
@echo "๐ Starting Hanzo cluster in stages..."
|
|
@echo ""
|
|
@echo "Stage 1: Starting Master server..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d master
|
|
@sleep 10
|
|
@echo ""
|
|
@echo "Stage 2: Starting Volume servers..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d volume1 volume2 volume3 volume4 volume5 volume6
|
|
@sleep 15
|
|
@echo ""
|
|
@echo "Stage 3: Starting Filer..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d filer
|
|
@sleep 10
|
|
@echo ""
|
|
@echo "Stage 4: Starting Admin server..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d admin
|
|
@sleep 15
|
|
@echo ""
|
|
@echo "Stage 5: Starting Workers..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d worker1 worker2 worker3
|
|
@sleep 10
|
|
@echo ""
|
|
@echo "Stage 6: Starting Load generator and Monitor..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d load_generator monitor
|
|
@echo ""
|
|
@echo "โ
All services started!"
|
|
@echo ""
|
|
@echo "๐ Access points:"
|
|
@echo " โข Admin UI: http://localhost:23646/"
|
|
@echo " โข Master UI: http://localhost:9333/"
|
|
@echo " โข Filer: http://localhost:8888/"
|
|
@echo ""
|
|
@echo "โณ Services are initializing... Use 'make status' to check progress"
|
|
|
|
stop: ## Stop all services
|
|
@echo "๐ Stopping Hanzo cluster..."
|
|
@docker-compose -f $(COMPOSE_FILE) down
|
|
@echo "โ
Cluster stopped"
|
|
|
|
restart: stop start ## Restart the entire cluster
|
|
|
|
clean: ## Stop and remove all containers, networks, and volumes
|
|
@echo "๐งน Cleaning up Hanzo test environment..."
|
|
@docker-compose -f $(COMPOSE_FILE) down -v --remove-orphans
|
|
@docker system prune -f
|
|
@rm -rf data/
|
|
@echo "โ
Environment cleaned"
|
|
|
|
status: ## Check the status of all services
|
|
@echo "๐ Hanzo Cluster Status"
|
|
@echo "=========================="
|
|
@docker-compose -f $(COMPOSE_FILE) ps
|
|
@echo ""
|
|
@echo "๐ Service Health:"
|
|
@echo "Master:"
|
|
@curl -s http://localhost:9333/cluster/status | jq '.IsLeader' 2>/dev/null || echo " โ Master not ready"
|
|
@echo "Admin:"
|
|
@curl -s http://localhost:23646/ | grep -q "Admin" && echo " โ
Admin ready" || echo " โ Admin not ready"
|
|
|
|
logs: ## Show logs from all services
|
|
@echo "๐ Following logs from all services..."
|
|
@echo "๐ก Press Ctrl+C to stop following logs"
|
|
@docker-compose -f $(COMPOSE_FILE) logs -f
|
|
|
|
admin-logs: ## Show logs from admin server only
|
|
@echo "๐ Admin server logs:"
|
|
@docker-compose -f $(COMPOSE_FILE) logs -f admin
|
|
|
|
worker-logs: ## Show logs from all workers
|
|
@echo "๐ Worker logs:"
|
|
@docker-compose -f $(COMPOSE_FILE) logs -f worker1 worker2 worker3
|
|
|
|
master-logs: ## Show logs from master server
|
|
@echo "๐ Master server logs:"
|
|
@docker-compose -f $(COMPOSE_FILE) logs -f master
|
|
|
|
admin-ui: ## Open admin UI in browser (macOS)
|
|
@echo "๐ Opening admin UI in browser..."
|
|
@open http://localhost:23646/ || echo "๐ก Manually open: http://localhost:23646/"
|
|
|
|
test: ## Run integration test to verify task assignment and completion
|
|
@echo "๐งช Running Admin-Worker Integration Test"
|
|
@echo "========================================"
|
|
@echo ""
|
|
@echo "1๏ธโฃ Checking cluster health..."
|
|
@sleep 5
|
|
@curl -s http://localhost:9333/cluster/status | jq '.IsLeader' > /dev/null && echo "โ
Master healthy" || echo "โ Master not ready"
|
|
@curl -s http://localhost:23646/ | grep -q "Admin" && echo "โ
Admin healthy" || echo "โ Admin not ready"
|
|
@echo ""
|
|
@echo "2๏ธโฃ Checking worker registration..."
|
|
@sleep 10
|
|
@echo "๐ก Check admin UI for connected workers: http://localhost:23646/"
|
|
@echo ""
|
|
@echo "3๏ธโฃ Generating load to trigger EC tasks..."
|
|
@echo "๐ Creating test files to fill volumes..."
|
|
@echo "Creating large files with random data to trigger EC (targeting ~60MB total to exceed 50MB limit)..."
|
|
@for i in {1..12}; do \
|
|
echo "Creating 5MB random file $$i..."; \
|
|
docker run --rm --network admin_integration_hanzo_net -v /tmp:/tmp --entrypoint sh ghcr.io/hanzoai/s3:local -c "dd if=/dev/urandom of=/tmp/largefile$$i.dat bs=1M count=5 2>/dev/null && s3 upload -master=master:9333 /tmp/largefile$$i.dat && rm /tmp/largefile$$i.dat"; \
|
|
sleep 3; \
|
|
done
|
|
@echo ""
|
|
@echo "4๏ธโฃ Waiting for volumes to process large files and reach 50MB limit..."
|
|
@echo "This may take a few minutes as we're uploading 60MB of data..."
|
|
@sleep 60
|
|
@echo ""
|
|
@echo "5๏ธโฃ Checking for EC task creation and assignment..."
|
|
@echo "๐ก Monitor the admin UI to see:"
|
|
@echo " โข Tasks being created for volumes needing EC"
|
|
@echo " โข Workers picking up tasks"
|
|
@echo " โข Task progress (pending โ running โ completed)"
|
|
@echo " โข EC shards being distributed"
|
|
@echo ""
|
|
@echo "โ
Integration test setup complete!"
|
|
@echo "๐ Monitor progress at: http://localhost:23646/"
|
|
|
|
quick-test: ## Quick verification that core services are running
|
|
@echo "โก Quick Health Check"
|
|
@echo "===================="
|
|
@echo "Master: $$(curl -s http://localhost:9333/cluster/status | jq -r '.IsLeader // "not ready"')"
|
|
@echo "Admin: $$(curl -s http://localhost:23646/ | grep -q "Admin" && echo "ready" || echo "not ready")"
|
|
@echo "Workers: $$(docker-compose -f $(COMPOSE_FILE) ps worker1 worker2 worker3 | grep -c Up) running"
|
|
|
|
validate: ## Validate integration test configuration
|
|
@echo "๐ Validating Integration Test Configuration"
|
|
@echo "==========================================="
|
|
@chmod +x test-integration.sh
|
|
@./test-integration.sh
|
|
|
|
demo: start ## Start cluster and run demonstration
|
|
@echo "๐ญ Hanzo Admin-Worker Demo"
|
|
@echo "============================="
|
|
@echo ""
|
|
@echo "โณ Waiting for services to start..."
|
|
@sleep 45
|
|
@echo ""
|
|
@echo "๐ฏ Demo Overview:"
|
|
@echo " โข 1 Master server (coordinates cluster)"
|
|
@echo " โข 6 Volume servers (50MB volume limit)"
|
|
@echo " โข 1 Admin server (task management)"
|
|
@echo " โข 3 Workers (execute EC tasks)"
|
|
@echo " โข Load generator (creates files continuously)"
|
|
@echo ""
|
|
@echo "๐ Watch the process:"
|
|
@echo " 1. Visit: http://localhost:23646/"
|
|
@echo " 2. Observe workers connecting"
|
|
@echo " 3. Watch tasks being created and assigned"
|
|
@echo " 4. See tasks progress from pending โ completed"
|
|
@echo ""
|
|
@echo "๐ The demo will:"
|
|
@echo " โข Fill volumes to 50MB limit"
|
|
@echo " โข Admin detects volumes needing EC"
|
|
@echo " โข Workers receive and execute EC tasks"
|
|
@echo " โข Tasks complete with shard distribution"
|
|
@echo ""
|
|
@echo "๐ก Use 'make worker-logs' to see worker activity"
|
|
@echo "๐ก Use 'make admin-logs' to see admin task management"
|
|
|
|
# Vacuum Testing Targets
|
|
vacuum-test: ## Create test data with garbage and verify vacuum detection
|
|
@echo "๐งช Hanzo Vacuum Task Testing"
|
|
@echo "================================"
|
|
@echo ""
|
|
@echo "1๏ธโฃ Checking cluster health..."
|
|
@curl -s http://localhost:9333/cluster/status | jq '.IsLeader' > /dev/null && echo "โ
Master ready" || (echo "โ Master not ready. Run 'make start' first." && exit 1)
|
|
@curl -s http://localhost:23646/ | grep -q "Admin" && echo "โ
Admin ready" || (echo "โ Admin not ready. Run 'make start' first." && exit 1)
|
|
@echo ""
|
|
@echo "2๏ธโฃ Creating test data with garbage..."
|
|
@docker-compose -f $(COMPOSE_FILE) exec vacuum-tester go run create_vacuum_test_data.go -files=25 -delete=0.5 -size=200
|
|
@echo ""
|
|
@echo "3๏ธโฃ Configuration Instructions:"
|
|
@echo " Visit: http://localhost:23646/maintenance/config/vacuum"
|
|
@echo " Set for testing:"
|
|
@echo " โข Enable Vacuum Tasks: โ
Checked"
|
|
@echo " โข Garbage Threshold: 0.20 (20%)"
|
|
@echo " โข Scan Interval: [30] [Seconds]"
|
|
@echo " โข Min Volume Age: [0] [Minutes]"
|
|
@echo " โข Max Concurrent: 2"
|
|
@echo ""
|
|
@echo "4๏ธโฃ Monitor vacuum tasks at: http://localhost:23646/maintenance"
|
|
@echo ""
|
|
@echo "๐ก Use 'make vacuum-status' to check volume garbage ratios"
|
|
|
|
vacuum-demo: ## Run automated vacuum testing demonstration
|
|
@echo "๐ญ Vacuum Task Demo"
|
|
@echo "=================="
|
|
@echo ""
|
|
@echo "โ ๏ธ This demo requires user interaction for configuration"
|
|
@echo "๐ก Make sure cluster is running with 'make start'"
|
|
@echo ""
|
|
@docker-compose -f $(COMPOSE_FILE) exec vacuum-tester sh -c "chmod +x demo_vacuum_testing.sh && ./demo_vacuum_testing.sh"
|
|
|
|
vacuum-status: ## Check current volume status and garbage ratios
|
|
@echo "๐ Current Volume Status"
|
|
@echo "======================="
|
|
@docker-compose -f $(COMPOSE_FILE) exec vacuum-tester sh -c "chmod +x check_volumes.sh && ./check_volumes.sh"
|
|
|
|
vacuum-data: ## Create test data with configurable parameters
|
|
@echo "๐ Creating vacuum test data..."
|
|
@echo "Usage: make vacuum-data [FILES=20] [DELETE=0.4] [SIZE=100]"
|
|
@echo ""
|
|
@docker-compose -f $(COMPOSE_FILE) exec vacuum-tester go run create_vacuum_test_data.go \
|
|
-files=$${FILES:-20} \
|
|
-delete=$${DELETE:-0.4} \
|
|
-size=$${SIZE:-100}
|
|
|
|
vacuum-data-high: ## Create high garbage ratio test data (should trigger vacuum)
|
|
@echo "๐ Creating high garbage test data (70% garbage)..."
|
|
@docker-compose -f $(COMPOSE_FILE) exec vacuum-tester go run create_vacuum_test_data.go -files=30 -delete=0.7 -size=150
|
|
|
|
vacuum-data-low: ## Create low garbage ratio test data (should NOT trigger vacuum)
|
|
@echo "๐ Creating low garbage test data (15% garbage)..."
|
|
@docker-compose -f $(COMPOSE_FILE) exec vacuum-tester go run create_vacuum_test_data.go -files=30 -delete=0.15 -size=150
|
|
|
|
vacuum-continuous: ## Generate garbage continuously for testing
|
|
@echo "๐ Generating continuous garbage for vacuum testing..."
|
|
@echo "Creating 5 rounds of test data with 30-second intervals..."
|
|
@for i in {1..5}; do \
|
|
echo "Round $$i: Creating garbage..."; \
|
|
docker-compose -f $(COMPOSE_FILE) exec vacuum-tester go run create_vacuum_test_data.go -files=10 -delete=0.6 -size=100; \
|
|
echo "Waiting 30 seconds..."; \
|
|
sleep 30; \
|
|
done
|
|
@echo "โ
Continuous test complete. Check vacuum task activity!"
|
|
|
|
vacuum-clean: ## Clean up vacuum test data (removes all volumes!)
|
|
@echo "๐งน Cleaning up vacuum test data..."
|
|
@echo "โ ๏ธ WARNING: This will delete ALL volumes!"
|
|
@read -p "Are you sure? (y/N): " confirm && [ "$$confirm" = "y" ] || exit 1
|
|
@echo "Stopping cluster..."
|
|
@docker-compose -f $(COMPOSE_FILE) down
|
|
@echo "Removing volume data..."
|
|
@rm -rf data/volume*/
|
|
@echo "Restarting cluster..."
|
|
@docker-compose -f $(COMPOSE_FILE) up -d
|
|
@echo "โ
Clean up complete. Fresh volumes ready for testing."
|
|
|
|
vacuum-help: ## Show vacuum testing help and examples
|
|
@echo "๐งช Vacuum Testing Commands (Docker-based)"
|
|
@echo "=========================================="
|
|
@echo ""
|
|
@echo "Quick Start:"
|
|
@echo " make start # Start Hanzo cluster with vacuum-tester"
|
|
@echo " make vacuum-test # Create test data and instructions"
|
|
@echo " make vacuum-status # Check volume status"
|
|
@echo ""
|
|
@echo "Data Generation:"
|
|
@echo " make vacuum-data-high # High garbage (should trigger)"
|
|
@echo " make vacuum-data-low # Low garbage (should NOT trigger)"
|
|
@echo " make vacuum-continuous # Continuous garbage generation"
|
|
@echo ""
|
|
@echo "Monitoring:"
|
|
@echo " make vacuum-status # Quick volume status check"
|
|
@echo " make vacuum-demo # Full guided demonstration"
|
|
@echo ""
|
|
@echo "Configuration:"
|
|
@echo " Visit: http://localhost:23646/maintenance/config/vacuum"
|
|
@echo " Monitor: http://localhost:23646/maintenance"
|
|
@echo ""
|
|
@echo "Custom Parameters:"
|
|
@echo " make vacuum-data FILES=50 DELETE=0.8 SIZE=200"
|
|
@echo ""
|
|
@echo "๐ก All commands now run inside Docker containers"
|
|
@echo "Documentation:"
|
|
@echo " See: VACUUM_TEST_README.md for complete guide"
|