refactor: update shell scripts for AI-Trader-Server rebrand

Update all shell scripts to use the new AI-Trader-Server naming throughout.

Changes:
- main.sh: Update comments and echo statements
- entrypoint.sh: Update startup message
- scripts/validate_docker_build.sh: Update title, container name references,
  and docker image tag from ai-trader-test to ai-trader-server-test
- scripts/test_api_endpoints.sh: Update title and docker-compose command

Part of Phase 4: Internal Configuration & Metadata (Task 19)
This commit is contained in:
2025-11-01 12:05:16 -04:00
parent 123915647e
commit 67454c4292
4 changed files with 20 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -e # Exit on any error set -e # Exit on any error
echo "🚀 Starting AI-Trader API Server..." echo "🚀 Starting AI-Trader-Server API..."
# Validate required environment variables # Validate required environment variables
echo "🔍 Validating environment variables..." echo "🔍 Validating environment variables..."

View File

@@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# AI-Trader 主启动脚本 # AI-Trader-Server 主启动脚本
# 用于启动完整的交易环境 # 用于启动完整的交易环境
set -e # 遇到错误时退出 set -e # 遇到错误时退出
echo "🚀 Launching AI Trader Environment..." echo "🚀 Launching AI-Trader-Server Environment..."
echo "📊 Now getting and merging price data..." echo "📊 Now getting and merging price data..."
@@ -25,7 +25,7 @@ sleep 2
echo "🤖 Now starting the main trading agent..." echo "🤖 Now starting the main trading agent..."
python main.py configs/default_config.json python main.py configs/default_config.json
echo "✅ AI-Trader stopped" echo "✅ AI-Trader-Server stopped"
echo "🔄 Starting web server..." echo "🔄 Starting web server..."
cd ./docs cd ./docs

View File

@@ -5,7 +5,7 @@
set -e set -e
echo "==========================================" echo "=========================================="
echo "AI-Trader API Endpoint Testing" echo "AI-Trader-Server API Endpoint Testing"
echo "==========================================" echo "=========================================="
echo "" echo ""
@@ -34,7 +34,7 @@ echo "Checking if API is accessible..."
if ! curl -f "$API_BASE_URL/health" &> /dev/null; then if ! curl -f "$API_BASE_URL/health" &> /dev/null; then
echo -e "${RED}${NC} API is not accessible at $API_BASE_URL" echo -e "${RED}${NC} API is not accessible at $API_BASE_URL"
echo "Make sure the container is running:" echo "Make sure the container is running:"
echo " docker-compose up -d ai-trader" echo " docker-compose up -d ai-trader-server"
exit 1 exit 1
fi fi
echo -e "${GREEN}${NC} API is accessible" echo -e "${GREEN}${NC} API is accessible"

View File

@@ -5,7 +5,7 @@
set -e # Exit on error set -e # Exit on error
echo "==========================================" echo "=========================================="
echo "AI-Trader Docker Build Validation" echo "AI-Trader-Server Docker Build Validation"
echo "==========================================" echo "=========================================="
echo "" echo ""
@@ -112,7 +112,7 @@ echo "Step 3: Building Docker image..."
echo "This may take several minutes on first build..." echo "This may take several minutes on first build..."
echo "" echo ""
if docker build -t ai-trader-test . ; then if docker build -t ai-trader-server-test . ; then
print_status 0 "Docker image built successfully" print_status 0 "Docker image built successfully"
else else
print_status 1 "Docker build failed" print_status 1 "Docker build failed"
@@ -124,11 +124,11 @@ echo ""
# Step 4: Check image # Step 4: Check image
echo "Step 4: Verifying Docker image..." echo "Step 4: Verifying Docker image..."
IMAGE_SIZE=$(docker images ai-trader-test --format "{{.Size}}") IMAGE_SIZE=$(docker images ai-trader-server-test --format "{{.Size}}")
print_status 0 "Image size: $IMAGE_SIZE" print_status 0 "Image size: $IMAGE_SIZE"
# List exposed ports # List exposed ports
EXPOSED_PORTS=$(docker inspect ai-trader-test --format '{{range $p, $conf := .Config.ExposedPorts}}{{$p}} {{end}}') EXPOSED_PORTS=$(docker inspect ai-trader-server-test --format '{{range $p, $conf := .Config.ExposedPorts}}{{$p}} {{end}}')
print_status 0 "Exposed ports: $EXPOSED_PORTS" print_status 0 "Exposed ports: $EXPOSED_PORTS"
echo "" echo ""
@@ -137,7 +137,7 @@ echo ""
echo "Step 5: Testing API mode startup..." echo "Step 5: Testing API mode startup..."
echo "Starting container in background..." echo "Starting container in background..."
$COMPOSE_CMD up -d ai-trader $COMPOSE_CMD up -d ai-trader-server
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
print_status 0 "Container started successfully" print_status 0 "Container started successfully"
@@ -146,20 +146,20 @@ if [ $? -eq 0 ]; then
sleep 10 sleep 10
# Check if container is still running # Check if container is still running
if docker ps | grep -q ai-trader; then if docker ps | grep -q ai-trader-server; then
print_status 0 "Container is running" print_status 0 "Container is running"
# Check logs for errors # Check logs for errors
ERROR_COUNT=$(docker logs ai-trader 2>&1 | grep -i "error" | grep -v "ERROR:" | wc -l) ERROR_COUNT=$(docker logs ai-trader-server 2>&1 | grep -i "error" | grep -v "ERROR:" | wc -l)
if [ $ERROR_COUNT -gt 0 ]; then if [ $ERROR_COUNT -gt 0 ]; then
print_warning "Found $ERROR_COUNT error messages in logs" print_warning "Found $ERROR_COUNT error messages in logs"
echo "Check logs with: docker logs ai-trader" echo "Check logs with: docker logs ai-trader-server"
else else
print_status 0 "No critical errors in logs" print_status 0 "No critical errors in logs"
fi fi
else else
print_status 1 "Container stopped unexpectedly" print_status 1 "Container stopped unexpectedly"
echo "Check logs with: docker logs ai-trader" echo "Check logs with: docker logs ai-trader-server"
exit 1 exit 1
fi fi
else else
@@ -209,14 +209,14 @@ else
print_warning "Diagnostics:" print_warning "Diagnostics:"
# Check if container is still running # Check if container is still running
if docker ps | grep -q ai-trader; then if docker ps | grep -q ai-trader-server; then
echo " ✓ Container is running" echo " ✓ Container is running"
else else
echo " ✗ Container has stopped" echo " ✗ Container has stopped"
fi fi
# Check if port is listening # Check if port is listening
if docker exec ai-trader netstat -tuln 2>/dev/null | grep -q ":8080"; then if docker exec ai-trader-server netstat -tuln 2>/dev/null | grep -q ":8080"; then
echo " ✓ Port 8080 is listening inside container" echo " ✓ Port 8080 is listening inside container"
else else
echo " ✗ Port 8080 is NOT listening inside container" echo " ✗ Port 8080 is NOT listening inside container"
@@ -224,7 +224,7 @@ else
# Try curl from inside container # Try curl from inside container
echo " Testing from inside container..." echo " Testing from inside container..."
INTERNAL_TEST=$(docker exec ai-trader curl -f -s http://localhost:8080/health 2>&1) INTERNAL_TEST=$(docker exec ai-trader-server curl -f -s http://localhost:8080/health 2>&1)
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo " ✓ Health endpoint works inside container: $INTERNAL_TEST" echo " ✓ Health endpoint works inside container: $INTERNAL_TEST"
echo " ✗ Issue is with port mapping or host networking" echo " ✗ Issue is with port mapping or host networking"
@@ -235,7 +235,7 @@ else
echo "" echo ""
echo "Recent logs:" echo "Recent logs:"
docker logs ai-trader 2>&1 | tail -20 docker logs ai-trader-server 2>&1 | tail -20
fi fi
echo "" echo ""
@@ -262,7 +262,7 @@ echo "2. Test batch mode:"
echo " bash scripts/test_batch_mode.sh" echo " bash scripts/test_batch_mode.sh"
echo "" echo ""
echo "3. If any checks failed, review logs:" echo "3. If any checks failed, review logs:"
echo " docker logs ai-trader" echo " docker logs ai-trader-server"
echo "" echo ""
echo "4. For troubleshooting, see: DOCKER_API.md" echo "4. For troubleshooting, see: DOCKER_API.md"
echo "" echo ""