2026-05-19 20:50:08 -04:00
|
|
|
#!/bin/bash
|
2026-05-20 14:05:51 -04:00
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
# ── Hermes Workspace + Swarm Worker Entrypoint ──
|
|
|
|
|
# Starts Hermes Workspace web UI (port 3000) and makes
|
|
|
|
|
# hermes CLI + tmux available for Swarm workers.
|
|
|
|
|
# The Hermes gateway runs in a separate container (hermes:8642).
|
|
|
|
|
# Swarm workers spawned here connect to the gateway via HTTP.
|
|
|
|
|
# ──────────────────────────────────────────────────────────
|
|
|
|
|
|
|
|
|
|
# Install custom tools from persistent volume
|
|
|
|
|
if [ -f /opt/data/hermes-tools/install.sh ]; then
|
|
|
|
|
bash /opt/data/hermes-tools/install.sh || true
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Wait for Hermes gateway to be healthy before starting workspace
|
|
|
|
|
if [ -n "${HERMES_API_URL:-}" ]; then
|
|
|
|
|
echo "Waiting for Hermes gateway..."
|
|
|
|
|
for i in $(seq 1 30); do
|
|
|
|
|
if curl -fsS "${HERMES_API_URL}/health" >/dev/null 2>&1; then
|
|
|
|
|
echo "Gateway healthy after ${i}s"
|
|
|
|
|
break
|
2026-05-19 20:50:08 -04:00
|
|
|
fi
|
2026-05-20 14:05:51 -04:00
|
|
|
if [ "$i" -eq 30 ]; then
|
|
|
|
|
echo "WARNING: Gateway not healthy after 30s, starting workspace anyway"
|
2026-05-19 20:50:08 -04:00
|
|
|
fi
|
2026-05-20 14:05:51 -04:00
|
|
|
sleep 1
|
|
|
|
|
done
|
|
|
|
|
fi
|
2026-05-19 20:50:08 -04:00
|
|
|
|
2026-05-20 14:05:51 -04:00
|
|
|
# Start Hermes Workspace in foreground
|
|
|
|
|
cd /workspace
|
|
|
|
|
exec node --max-old-space-size=2048 server-entry.js
|