-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhive-docker.sh
More file actions
executable file
·72 lines (62 loc) · 1.91 KB
/
hive-docker.sh
File metadata and controls
executable file
·72 lines (62 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
# Levanta Hive en Docker y abre el navegador cuando esté listo
# Crear .env si no existe para configurar acceso a archivos del host
if [ ! -f ".env" ]; then
cat > .env << 'EOF'
# Hive home directory - acceso a archivos del host
# El agente podrá acceder a este directorio configurando workspace en la UI
# Más información: https://github.com/johpaz/hive#acceso-a-archivos-del-sistema-desde-docker
EOF
case "$(uname -s)" in
Darwin)
echo "HIVE_HOME_PATH=/Users/\$USER" >> .env
;;
Linux)
echo "HIVE_HOME_PATH=/home/\$USER" >> .env
;;
MINGW*|CYGWIN*|MSYS*)
echo "HIVE_HOME_PATH=C:/Users/\$env:USERNAME" >> .env
;;
*)
echo "# HIVE_HOME_PATH=./workspace" >> .env
;;
esac
echo "📝 Creado .env con HIVE_HOME_PATH para tu sistema"
echo " El agente podrá acceder a tus archivos configurando workspace en la UI"
fi
PORT=${HIVE_PORT:-18790}
URL="http://localhost:$PORT"
MAX_WAIT=60
# Si ya está corriendo, sólo abrir el navegador
if curl -sf "$URL/health" > /dev/null 2>&1; then
echo "✅ Hive ya está corriendo"
else
docker compose up -d
echo "⏳ Esperando que Hive esté listo en $URL ..."
i=0
while [ $i -lt $MAX_WAIT ]; do
if curl -sf "$URL/health" > /dev/null 2>&1; then
break
fi
sleep 1
i=$((i + 1))
done
if [ $i -ge $MAX_WAIT ]; then
echo "⚠️ Hive no respondió en ${MAX_WAIT}s. Abre manualmente: $URL"
exit 1
fi
fi
# Detectar si ya fue configurado
SETUP_MODE=$(curl -sf "$URL/api/setup/status" | grep -o '"setupMode":true' || true)
if [ -n "$SETUP_MODE" ]; then
OPEN_URL="$URL/setup"
else
OPEN_URL="$URL"
fi
echo "✅ Hive listo — abriendo $OPEN_URL"
case "$(uname -s)" in
Darwin) open "$OPEN_URL" ;;
Linux) gio open "$OPEN_URL" 2>/dev/null || xdg-open "$OPEN_URL" 2>/dev/null || echo "Abre: $OPEN_URL" ;;
MINGW*|CYGWIN*|MSYS*) start "" "$OPEN_URL" ;;
*) echo "Abre: $OPEN_URL" ;;
esac