refactor: update scripts for kebab-case service binary names
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,7 @@ set -euo pipefail
|
||||
# Usage:
|
||||
# ./infra/scripts/build-and-push.sh # Build & push all
|
||||
# ./infra/scripts/build-and-push.sh --no-push # Build only
|
||||
# ./infra/scripts/build-and-push.sh --services "api_gateway trading_service"
|
||||
# ./infra/scripts/build-and-push.sh --services "api-gateway trading-service"
|
||||
# ./infra/scripts/build-and-push.sh --parallel 3 # 3 concurrent builds
|
||||
# ./infra/scripts/build-and-push.sh --dry-run # Show what would run
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -23,12 +23,12 @@ TIMESTAMP=$(date -u +"%Y%m%d-%H%M%S")
|
||||
|
||||
# Services built with Dockerfile.service (--build-arg SERVICE=<name>)
|
||||
STANDARD_SERVICES=(
|
||||
api_gateway
|
||||
trading_service
|
||||
trading_agent_service
|
||||
ml_training_service
|
||||
backtesting_service
|
||||
broker_gateway_service
|
||||
api-gateway
|
||||
trading-service
|
||||
trading-agent-service
|
||||
ml-training-service
|
||||
backtesting-service
|
||||
broker-gateway
|
||||
)
|
||||
|
||||
# Defaults
|
||||
|
||||
@@ -109,7 +109,7 @@ echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Your database is now set up and migrations have been applied"
|
||||
echo "2. SQLx should now work for compile-time verification"
|
||||
echo "3. You can start the services with: cargo run --bin trading_service"
|
||||
echo "3. You can start the services with: cargo run --bin trading-service"
|
||||
echo ""
|
||||
echo "Database connection details:"
|
||||
echo " URL: $DATABASE_URL"
|
||||
|
||||
@@ -82,14 +82,14 @@ BACKTESTING_PORT=50052
|
||||
ML_TRAINING_PORT=50053
|
||||
|
||||
# Kill any existing services
|
||||
pkill -f "trading_service" || true
|
||||
pkill -f "backtesting_service" || true
|
||||
pkill -f "ml_training_service" || true
|
||||
pkill -f "trading-service" || true
|
||||
pkill -f "backtesting-service" || true
|
||||
pkill -f "ml-training-service" || true
|
||||
sleep 2
|
||||
|
||||
# Step 4: Build and start the 3 standalone services
|
||||
echo -e "${BLUE}🏗️ Building services...${NC}"
|
||||
if ! cargo build --release --bin trading_service --bin backtesting_service -p ml_training_service; then
|
||||
if ! cargo build --release --bin trading-service --bin backtesting-service -p ml_training_service; then
|
||||
echo -e "${RED}❌ Failed to build services. Check compilation errors.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
@@ -101,21 +101,21 @@ echo -e "${BLUE}🚀 Starting standalone services...${NC}"
|
||||
|
||||
# Start Trading Service (port 50051)
|
||||
echo "📈 Starting Trading Service..."
|
||||
cargo run --release --bin trading_service &
|
||||
cargo run --release --bin trading-service &
|
||||
TRADING_PID=$!
|
||||
echo $TRADING_PID > .trading_service.pid
|
||||
echo $TRADING_PID > .trading-service.pid
|
||||
|
||||
# Start Backtesting Service (port 50052)
|
||||
echo "🔄 Starting Backtesting Service..."
|
||||
cargo run --release -p backtesting_service &
|
||||
BACKTESTING_PID=$!
|
||||
echo $BACKTESTING_PID > .backtesting_service.pid
|
||||
echo $BACKTESTING_PID > .backtesting-service.pid
|
||||
|
||||
# Start ML Training Service (port 50053)
|
||||
echo "🧠 Starting ML Training Service..."
|
||||
cargo run --release -p ml_training_service &
|
||||
ML_TRAINING_PID=$!
|
||||
echo $ML_TRAINING_PID > .ml_training_service.pid
|
||||
echo $ML_TRAINING_PID > .ml-training-service.pid
|
||||
|
||||
# Step 6: Wait for all services to be ready
|
||||
echo -e "${YELLOW}⏳ Waiting for services to start...${NC}"
|
||||
|
||||
@@ -15,32 +15,32 @@ echo "Shutting down: 3 Services + Docker Databases"
|
||||
# Step 1: Stop services by PID files if they exist
|
||||
echo -e "${BLUE}🔌 Stopping standalone services...${NC}"
|
||||
|
||||
if [ -f .trading_service.pid ]; then
|
||||
TRADING_PID=$(cat .trading_service.pid)
|
||||
if [ -f .trading-service.pid ]; then
|
||||
TRADING_PID=$(cat .trading-service.pid)
|
||||
echo "📈 Stopping Trading Service (PID: $TRADING_PID)"
|
||||
kill $TRADING_PID 2>/dev/null || true
|
||||
rm -f .trading_service.pid
|
||||
rm -f .trading-service.pid
|
||||
fi
|
||||
|
||||
if [ -f .backtesting_service.pid ]; then
|
||||
BACKTEST_PID=$(cat .backtesting_service.pid)
|
||||
if [ -f .backtesting-service.pid ]; then
|
||||
BACKTEST_PID=$(cat .backtesting-service.pid)
|
||||
echo "🔄 Stopping Backtesting Service (PID: $BACKTEST_PID)"
|
||||
kill $BACKTEST_PID 2>/dev/null || true
|
||||
rm -f .backtesting_service.pid
|
||||
rm -f .backtesting-service.pid
|
||||
fi
|
||||
|
||||
if [ -f .ml_training_service.pid ]; then
|
||||
ML_PID=$(cat .ml_training_service.pid)
|
||||
if [ -f .ml-training-service.pid ]; then
|
||||
ML_PID=$(cat .ml-training-service.pid)
|
||||
echo "🧠 Stopping ML Training Service (PID: $ML_PID)"
|
||||
kill $ML_PID 2>/dev/null || true
|
||||
rm -f .ml_training_service.pid
|
||||
rm -f .ml-training-service.pid
|
||||
fi
|
||||
|
||||
# Step 2: Fallback - kill by process name
|
||||
echo -e "${YELLOW}🧹 Cleaning up any remaining service processes...${NC}"
|
||||
pkill -f "trading_service" || true
|
||||
pkill -f "backtesting_service" || true
|
||||
pkill -f "ml_training_service" || true
|
||||
pkill -f "trading-service" || true
|
||||
pkill -f "backtesting-service" || true
|
||||
pkill -f "ml-training-service" || true
|
||||
|
||||
# Give processes time to shut down gracefully
|
||||
sleep 2
|
||||
|
||||
@@ -106,11 +106,11 @@ echo
|
||||
|
||||
# Build validation tool if not already built
|
||||
echo "Building validation tool..."
|
||||
cargo build --release -p backtesting_service --bin validate_dbn_data 2>&1 | grep -v "Compiling\|Finished" || true
|
||||
cargo build --release -p backtesting-service --bin validate_dbn_data 2>&1 | grep -v "Compiling\|Finished" || true
|
||||
echo
|
||||
|
||||
# Run validation
|
||||
VALIDATION_CMD="cargo run --release -p backtesting_service --bin validate_dbn_data --"
|
||||
VALIDATION_CMD="cargo run --release -p backtesting-service --bin validate_dbn_data --"
|
||||
|
||||
if [ -n "$SYMBOL" ]; then
|
||||
VALIDATION_CMD="$VALIDATION_CMD --symbol $SYMBOL"
|
||||
|
||||
Reference in New Issue
Block a user