Update Vibe Kanban setup and scripts

- Added new entries to .gitignore for environment files and dynamically generated Docker Compose files.
- Updated documentation to reflect the new path for the Vibe Kanban dev server script.
- Enhanced task composition scripts to extract TASK_SLOT from TASK_ID, ensuring unique Orleans ports and preventing conflicts.
- Removed the old vibe-dev-server script, consolidating functionality into the new structure.
This commit is contained in:
2025-12-31 04:36:20 +07:00
parent 2e0baa45c0
commit ab08e0241b
13 changed files with 1535 additions and 35 deletions

View File

@@ -29,8 +29,23 @@ ORLEANS_GATEWAY_PORT=$((30000 + PORT_OFFSET))
DB_NAME="managing_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
ORLEANS_DB_NAME="orleans_$(echo "$TASK_ID" | tr '[:upper:]' '[:lower:]')"
# Calculate unique task slot based on port offset (for Orleans clustering)
TASK_SLOT=$((PORT_OFFSET / 10 + 1))
# Extract TASK_SLOT from TASK_ID numeric part (e.g., TASK-5439 -> 5439)
# This ensures unique Orleans ports for each task and prevents port conflicts
# Use TASK_SLOT from environment if already set (from vibe-setup.sh config), otherwise extract from TASK_ID
if [ -z "$TASK_SLOT" ] || [ "$TASK_SLOT" = "0" ]; then
TASK_SLOT=$(echo "$TASK_ID" | grep -oE '[0-9]+' | head -1)
if [ -z "$TASK_SLOT" ] || [ "$TASK_SLOT" = "0" ]; then
# Fallback: use port offset calculation if TASK_ID doesn't contain numbers
TASK_SLOT=$((PORT_OFFSET / 10 + 1))
echo "⚠️ TASK_ID doesn't contain a number, using port offset-based TASK_SLOT: $TASK_SLOT"
else
echo "📊 TASK_SLOT extracted from TASK_ID: $TASK_SLOT"
fi
else
echo "📊 Using TASK_SLOT from configuration: $TASK_SLOT"
fi
# TASK_SLOT determines Orleans ports: Silo = 11111 + (TASK_SLOT - 1) * 10, Gateway = 30000 + (TASK_SLOT - 1) * 10
# PID files for process management
PID_DIR="$PROJECT_ROOT/.task-pids"
@@ -44,6 +59,10 @@ export ASPNETCORE_URLS="http://localhost:${API_PORT}"
export RUN_ORLEANS_GRAINS=true
export SILO_ROLE=Trading
export TASK_SLOT=${TASK_SLOT}
export TASK_ID=${TASK_ID}
export PORT_OFFSET=${PORT_OFFSET}
# Orleans ports are calculated from TASK_SLOT in the application
# These exports are kept for reference but not used (TASK_SLOT is the source of truth)
export PostgreSql__ConnectionString="Host=localhost;Port=${POSTGRES_PORT};Database=${DB_NAME};Username=postgres;Password=postgres"
export PostgreSql__Orleans="Host=localhost;Port=${POSTGRES_PORT};Database=${ORLEANS_DB_NAME};Username=postgres;Password=postgres"
export InfluxDb__Url="http://localhost:8086/"
@@ -75,6 +94,7 @@ fi
echo "🚀 Starting API on port $API_PORT..."
echo "📁 Running from: $PROJECT_ROOT"
cd "$PROJECT_ROOT/src/Managing.Api"
# Write all output to log file (warnings will be filtered when displaying)
dotnet run > "$PID_DIR/api-${TASK_ID}.log" 2>&1 &
API_PID=$!
echo $API_PID > "$API_PID_FILE"
@@ -86,6 +106,7 @@ sleep 3
echo "🚀 Starting Workers..."
cd "$PROJECT_ROOT/src/Managing.Workers"
# Set workers environment variables (separate from API)
# Write all output to log file (warnings will be filtered when displaying)
ASPNETCORE_ENVIRONMENT=Development \
PostgreSql__ConnectionString="Host=localhost;Port=${POSTGRES_PORT};Database=${DB_NAME};Username=postgres;Password=postgres" \
InfluxDb__Url="http://localhost:8086/" \