This repository has been archived on 2025-11-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
supervisor/scripts/run.sh
Timur Gordon b8ef14d06c Simplify build.sh and update run.sh for self-contained execution
- Simplified build.sh to just build in release mode with warning suppression
- Updated run.sh to build first, then start supervisor and admin UI together
- Run script now starts both supervisor API and admin UI in background
- Added proper cleanup handler for graceful shutdown
- Removed admin UI compilation errors by fixing JsValue handling
- Added list_jobs method to WASM client for admin UI compatibility
2025-11-04 17:05:01 +01:00

64 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -e
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
PROJECT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
# Build first
"$SCRIPT_DIR/build.sh"
# Configuration
REDIS_URL="${REDIS_URL:-redis://localhost:6379}"
PORT="${PORT:-3030}"
BIND_ADDRESS="${BIND_ADDRESS:-127.0.0.1}"
BOOTSTRAP_ADMIN_KEY="${BOOTSTRAP_ADMIN_KEY:-admin}"
ADMIN_UI_PORT="${ADMIN_UI_PORT:-8080}"
LOG_LEVEL="${LOG_LEVEL:-info}"
# Cleanup function
cleanup() {
echo "Shutting down..."
kill $(jobs -p) 2>/dev/null || true
exit 0
}
trap cleanup SIGINT SIGTERM
echo "Starting Hero Supervisor..."
cd "$PROJECT_DIR"
# Start supervisor in background
RUST_LOG="$LOG_LEVEL" RUST_LOG_STYLE=never \
target/release/supervisor \
--bootstrap-admin-key "$BOOTSTRAP_ADMIN_KEY" \
--redis-url "$REDIS_URL" \
--port "$PORT" \
--bind-address "$BIND_ADDRESS" &
SUPERVISOR_PID=$!
# Wait for supervisor to start
sleep 2
# Check if supervisor is running
if ! ps -p $SUPERVISOR_PID > /dev/null 2>&1; then
echo "Failed to start supervisor"
exit 1
fi
# Start admin UI
echo "Starting Admin UI on port $ADMIN_UI_PORT..."
cd "$PROJECT_DIR/clients/admin-ui"
trunk serve --port "$ADMIN_UI_PORT" &
ADMIN_UI_PID=$!
echo ""
echo "✅ Hero Supervisor system started"
echo " 📡 Supervisor API: http://$BIND_ADDRESS:$PORT"
echo " 🎨 Admin UI: http://127.0.0.1:$ADMIN_UI_PORT"
echo ""
echo "Press Ctrl+C to stop all services"
# Wait for both processes
wait