|
|
@ -19,7 +19,7 @@ wait_for_service() { |
|
|
|
|
|
|
|
|
echo -e "${YELLOW}Waiting for $service to be ready...${NC}" |
|
|
echo -e "${YELLOW}Waiting for $service to be ready...${NC}" |
|
|
while [ $count -lt $max_wait ]; do |
|
|
while [ $count -lt $max_wait ]; do |
|
|
if docker-compose ps $service | grep -q "healthy\|Up"; then |
|
|
|
|
|
|
|
|
if docker compose ps $service | grep -q "healthy\|Up"; then |
|
|
echo -e "${GREEN}✓ $service is ready${NC}" |
|
|
echo -e "${GREEN}✓ $service is ready${NC}" |
|
|
return 0 |
|
|
return 0 |
|
|
fi |
|
|
fi |
|
|
@ -36,7 +36,7 @@ wait_for_service() { |
|
|
show_logs() { |
|
|
show_logs() { |
|
|
local service=$1 |
|
|
local service=$1 |
|
|
echo -e "${BLUE}=== $service logs ===${NC}" |
|
|
echo -e "${BLUE}=== $service logs ===${NC}" |
|
|
docker-compose logs --tail=20 $service |
|
|
|
|
|
|
|
|
docker compose logs --tail=20 $service |
|
|
echo |
|
|
echo |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -44,7 +44,7 @@ show_logs() { |
|
|
case "$1" in |
|
|
case "$1" in |
|
|
"start") |
|
|
"start") |
|
|
echo -e "${YELLOW}Starting SeaweedFS cluster and PostgreSQL server...${NC}" |
|
|
echo -e "${YELLOW}Starting SeaweedFS cluster and PostgreSQL server...${NC}" |
|
|
docker-compose up -d seaweedfs postgres-server |
|
|
|
|
|
|
|
|
docker compose up -d seaweedfs postgres-server |
|
|
|
|
|
|
|
|
wait_for_service "seaweedfs" 30 |
|
|
wait_for_service "seaweedfs" 30 |
|
|
wait_for_service "postgres-server" 15 |
|
|
wait_for_service "postgres-server" 15 |
|
|
@ -61,7 +61,7 @@ case "$1" in |
|
|
|
|
|
|
|
|
"produce") |
|
|
"produce") |
|
|
echo -e "${YELLOW}Creating MQ test data...${NC}" |
|
|
echo -e "${YELLOW}Creating MQ test data...${NC}" |
|
|
docker-compose up --build mq-producer |
|
|
|
|
|
|
|
|
docker compose up --build mq-producer |
|
|
|
|
|
|
|
|
if [ $? -eq 0 ]; then |
|
|
if [ $? -eq 0 ]; then |
|
|
echo -e "${GREEN}✓ Test data created successfully${NC}" |
|
|
echo -e "${GREEN}✓ Test data created successfully${NC}" |
|
|
@ -75,7 +75,7 @@ case "$1" in |
|
|
|
|
|
|
|
|
"test") |
|
|
"test") |
|
|
echo -e "${YELLOW}Running PostgreSQL client tests...${NC}" |
|
|
echo -e "${YELLOW}Running PostgreSQL client tests...${NC}" |
|
|
docker-compose up --build postgres-client |
|
|
|
|
|
|
|
|
docker compose up --build postgres-client |
|
|
|
|
|
|
|
|
if [ $? -eq 0 ]; then |
|
|
if [ $? -eq 0 ]; then |
|
|
echo -e "${GREEN}✓ Client tests completed${NC}" |
|
|
echo -e "${GREEN}✓ Client tests completed${NC}" |
|
|
@ -87,7 +87,7 @@ case "$1" in |
|
|
|
|
|
|
|
|
"psql") |
|
|
"psql") |
|
|
echo -e "${YELLOW}Connecting to PostgreSQL with psql...${NC}" |
|
|
echo -e "${YELLOW}Connecting to PostgreSQL with psql...${NC}" |
|
|
docker-compose run --rm psql-cli psql -h postgres-server -p 5432 -U seaweedfs -d default |
|
|
|
|
|
|
|
|
docker compose run --rm psql-cli psql -h postgres-server -p 5432 -U seaweedfs -d default |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
"logs") |
|
|
"logs") |
|
|
@ -97,18 +97,18 @@ case "$1" in |
|
|
|
|
|
|
|
|
"status") |
|
|
"status") |
|
|
echo -e "${BLUE}=== Service Status ===${NC}" |
|
|
echo -e "${BLUE}=== Service Status ===${NC}" |
|
|
docker-compose ps |
|
|
|
|
|
|
|
|
docker compose ps |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
"stop") |
|
|
"stop") |
|
|
echo -e "${YELLOW}Stopping all services...${NC}" |
|
|
echo -e "${YELLOW}Stopping all services...${NC}" |
|
|
docker-compose down |
|
|
|
|
|
|
|
|
docker compose down |
|
|
echo -e "${GREEN}✓ All services stopped${NC}" |
|
|
echo -e "${GREEN}✓ All services stopped${NC}" |
|
|
;; |
|
|
;; |
|
|
|
|
|
|
|
|
"clean") |
|
|
"clean") |
|
|
echo -e "${YELLOW}Cleaning up everything (including data)...${NC}" |
|
|
echo -e "${YELLOW}Cleaning up everything (including data)...${NC}" |
|
|
docker-compose down -v |
|
|
|
|
|
|
|
|
docker compose down -v |
|
|
docker system prune -f |
|
|
docker system prune -f |
|
|
echo -e "${GREEN}✓ Cleanup completed${NC}" |
|
|
echo -e "${GREEN}✓ Cleanup completed${NC}" |
|
|
;; |
|
|
;; |
|
|
@ -119,7 +119,7 @@ case "$1" in |
|
|
# Start services (wait_for_service ensures they're ready) |
|
|
# Start services (wait_for_service ensures they're ready) |
|
|
$0 start |
|
|
$0 start |
|
|
|
|
|
|
|
|
# Create data (docker-compose up is synchronous) |
|
|
|
|
|
|
|
|
# Create data (docker compose up is synchronous) |
|
|
$0 produce |
|
|
$0 produce |
|
|
|
|
|
|
|
|
# Run tests |
|
|
# Run tests |
|
|
|