diff --git a/scripts/setup/agent-bootstrap.sh b/scripts/setup/agent-bootstrap.sh index 708f402d7..43c18c7ce 100755 --- a/scripts/setup/agent-bootstrap.sh +++ b/scripts/setup/agent-bootstrap.sh @@ -28,7 +28,14 @@ if ! command -v clickhouse-server >/dev/null 2>&1; then clickhouse-server clickhouse-client fi -# --- 3. ElasticMQ jar (local SQS-compatible queue, no Docker) --- +# --- 3. Java runtime (required for ElasticMQ) --- +if ! command -v java >/dev/null 2>&1; then + log "Installing Java (required for ElasticMQ)" + sudo apt-get update -qq + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq default-jre-headless +fi + +# --- 4. ElasticMQ jar (local SQS-compatible queue, no Docker) --- ELASTICMQ_VERSION="1.6.11" ELASTICMQ_JAR="/opt/elasticmq/elasticmq.jar" if [ ! -f "$ELASTICMQ_JAR" ]; then @@ -66,7 +73,7 @@ queues { EOF fi -# --- 4. Bun workspace install --- +# --- 5. Bun workspace install --- if [ ! -d node_modules ]; then log "Installing workspace dependencies" bun install --frozen-lockfile diff --git a/scripts/setup/agent-services.sh b/scripts/setup/agent-services.sh index 8f954470f..555502672 100755 --- a/scripts/setup/agent-services.sh +++ b/scripts/setup/agent-services.sh @@ -19,10 +19,18 @@ if ! pgrep -f 'elasticmq.*\.jar' >/dev/null 2>&1; then >/var/log/autumn/elasticmq.log 2>&1 & disown || true log "Waiting for ElasticMQ to be ready" + ELASTICMQ_READY=0 for i in $(seq 1 30); do - curl -sf -o /dev/null 'http://localhost:9324/?Action=ListQueues&Version=2012-11-05' && break + if curl -sf -o /dev/null 'http://localhost:9324/?Action=ListQueues&Version=2012-11-05'; then + ELASTICMQ_READY=1 + break + fi sleep 0.5 done + if [ "$ELASTICMQ_READY" -eq 0 ]; then + echo "[agent-services] ERROR: ElasticMQ did not become ready after 15s. Check /var/log/autumn/elasticmq.log" >&2 + exit 1 + fi fi # --- 3. Ensure Postgres DB exists ---