mirror of
https://github.com/hanzoai/s3.git
synced 2026-10-30 14:59:09 +00:00
Full internal rename — build-verified, every module green (root + s3-rdma-sidecar
+ telemetry/server + all test modules):
- Dirs: weed/→s3/ (main tree); cmd/weed-{db,sql}→cmd/s3-{db,sql};
seaweed-volume→s3-volume; seaweedfs-rdma-sidecar→s3-rdma-sidecar;
s3/mount/weedfs_*.go→s3fs_*.go (~113 path renames).
- Imports: github.com/hanzoai/s3/weed/ → /s3/ across 1700+ files.
- gRPC proto services Seaweed/SeaweedFiler/SeaweedMessaging/... → Hanzo*
(8 services) via full protoc regeneration (correct descriptors, no sed-corruption).
- Brand SeaweedFS/Seaweed/seaweed → Hanzo/hanzo; internal X-Seaweedfs-* headers
→ X-Hanzo-*; .seaweedfs config dir → .s3.
- CLI is `s3`: go install github.com/hanzoai/s3/s3@latest | make install | Docker.
install.sh rewritten as a Hanzo S3 installer.
- External forks github.com/seaweedfs/{raft,go-fuse,goexif,cockroachdb-parser}
kept verbatim — immutable third-party module paths; NOTICE retained.
Residual (cosmetic, non-build): kafka loadtest test-proto package com.seaweedfs.loadtest.
130 lines
4.0 KiB
Bash
130 lines
4.0 KiB
Bash
#!/bin/bash
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${BLUE}=== Hanzo PostgreSQL Setup Validation ===${NC}"
|
|
|
|
# Check prerequisites
|
|
echo -e "${YELLOW}Checking prerequisites...${NC}"
|
|
|
|
if ! command -v docker &> /dev/null; then
|
|
echo -e "${RED}✗ Docker not found. Please install Docker.${NC}"
|
|
exit 1
|
|
fi
|
|
echo -e "${GREEN}✓ Docker found${NC}"
|
|
|
|
if ! command -v docker-compose &> /dev/null; then
|
|
echo -e "${RED}✗ Docker Compose not found. Please install Docker Compose.${NC}"
|
|
exit 1
|
|
fi
|
|
echo -e "${GREEN}✓ Docker Compose found${NC}"
|
|
|
|
# Check if running from correct directory
|
|
if [[ ! -f "docker-compose.yml" ]]; then
|
|
echo -e "${RED}✗ Must run from test/postgres directory${NC}"
|
|
echo " cd test/postgres && ./validate-setup.sh"
|
|
exit 1
|
|
fi
|
|
echo -e "${GREEN}✓ Running from correct directory${NC}"
|
|
|
|
# Check required files
|
|
required_files=("docker-compose.yml" "producer.go" "client.go" "Dockerfile.producer" "Dockerfile.client" "run-tests.sh")
|
|
for file in "${required_files[@]}"; do
|
|
if [[ ! -f "$file" ]]; then
|
|
echo -e "${RED}✗ Missing required file: $file${NC}"
|
|
exit 1
|
|
fi
|
|
done
|
|
echo -e "${GREEN}✓ All required files present${NC}"
|
|
|
|
# Test Docker Compose syntax
|
|
echo -e "${YELLOW}Validating Docker Compose configuration...${NC}"
|
|
if docker-compose config > /dev/null 2>&1; then
|
|
echo -e "${GREEN}✓ Docker Compose configuration valid${NC}"
|
|
else
|
|
echo -e "${RED}✗ Docker Compose configuration invalid${NC}"
|
|
docker-compose config
|
|
exit 1
|
|
fi
|
|
|
|
# Quick smoke test
|
|
echo -e "${YELLOW}Running smoke test...${NC}"
|
|
|
|
# Start services
|
|
echo "Starting services..."
|
|
docker-compose up -d hanzo postgres-server 2>/dev/null
|
|
|
|
# Wait a bit for services to start
|
|
sleep 15
|
|
|
|
# Check if services are running
|
|
hanzo_running=$(docker-compose ps hanzo | grep -c "Up")
|
|
postgres_running=$(docker-compose ps postgres-server | grep -c "Up")
|
|
|
|
if [[ $hanzo_running -eq 1 ]]; then
|
|
echo -e "${GREEN}✓ Hanzo service is running${NC}"
|
|
else
|
|
echo -e "${RED}✗ Hanzo service failed to start${NC}"
|
|
docker-compose logs hanzo | tail -10
|
|
fi
|
|
|
|
if [[ $postgres_running -eq 1 ]]; then
|
|
echo -e "${GREEN}✓ PostgreSQL server is running${NC}"
|
|
else
|
|
echo -e "${RED}✗ PostgreSQL server failed to start${NC}"
|
|
docker-compose logs postgres-server | tail -10
|
|
fi
|
|
|
|
# Test PostgreSQL connectivity
|
|
echo "Testing PostgreSQL connectivity..."
|
|
if timeout 10 docker run --rm --network "$(basename $(pwd))_hanzo-net" postgres:15-alpine \
|
|
psql -h postgres-server -p 5432 -U hanzo -d default -c "SELECT version();" > /dev/null 2>&1; then
|
|
echo -e "${GREEN}✓ PostgreSQL connectivity test passed${NC}"
|
|
else
|
|
echo -e "${RED}✗ PostgreSQL connectivity test failed${NC}"
|
|
fi
|
|
|
|
# Test Hanzo API
|
|
echo "Testing Hanzo API..."
|
|
if curl -s http://localhost:9333/cluster/status > /dev/null 2>&1; then
|
|
echo -e "${GREEN}✓ Hanzo API accessible${NC}"
|
|
else
|
|
echo -e "${RED}✗ Hanzo API not accessible${NC}"
|
|
fi
|
|
|
|
# Cleanup
|
|
echo -e "${YELLOW}Cleaning up...${NC}"
|
|
docker-compose down > /dev/null 2>&1
|
|
|
|
echo -e "${BLUE}=== Validation Summary ===${NC}"
|
|
|
|
if [[ $hanzo_running -eq 1 ]] && [[ $postgres_running -eq 1 ]]; then
|
|
echo -e "${GREEN}✓ Setup validation PASSED${NC}"
|
|
echo
|
|
echo "Your setup is ready! You can now run:"
|
|
echo " ./run-tests.sh all # Complete automated test"
|
|
echo " make all # Using Makefile"
|
|
echo " ./run-tests.sh start # Manual step-by-step"
|
|
echo
|
|
echo "For interactive testing:"
|
|
echo " ./run-tests.sh psql # Connect with psql"
|
|
echo
|
|
echo "Documentation:"
|
|
echo " cat README.md # Full documentation"
|
|
exit 0
|
|
else
|
|
echo -e "${RED}✗ Setup validation FAILED${NC}"
|
|
echo
|
|
echo "Please check the logs above and ensure:"
|
|
echo " • Docker and Docker Compose are properly installed"
|
|
echo " • All required files are present"
|
|
echo " • No other services are using ports 5432, 9333, 8888"
|
|
echo " • Docker daemon is running"
|
|
exit 1
|
|
fi
|