fix: install java in bootstrap, fail fast if ElasticMQ never ready

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
SirTenzin
2026-04-17 17:05:31 +00:00
parent 794a4afdf4
commit 640ea69abc
2 changed files with 18 additions and 3 deletions

View File

@@ -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

View File

@@ -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 ---