-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_all.sh
More file actions
executable file
·45 lines (36 loc) · 1.29 KB
/
Copy pathstart_all.sh
File metadata and controls
executable file
·45 lines (36 loc) · 1.29 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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
if docker compose version >/dev/null 2>&1; then
DC="docker compose"
elif command -v docker-compose >/dev/null 2>&1; then
DC="docker-compose"
else
echo "ERROR: Neither 'docker compose' nor 'docker-compose' is installed."
exit 1
fi
echo "[start_all] Using: $DC"
# Prevent common conflicts when another folder used same container_name values
echo "[start_all] Removing any existing containers with known names (ignore errors)..."
docker rm -f premarketml_web premarketml_batch_worker premarketml_prediction_worker >/dev/null 2>&1 || true
echo "[start_all] Building + starting containers..."
$DC -f "$COMPOSE_FILE" up -d --build
echo "[start_all] Waiting for Streamlit health..."
for i in {1..120}; do
if curl -fsS "http://localhost:8501/_stcore/health" >/dev/null 2>&1; then
echo "[start_all] Web is healthy."
break
fi
sleep 2
if [ "$i" -eq 120 ]; then
echo "[start_all] Timed out waiting for web."
$DC -f "$COMPOSE_FILE" ps || true
exit 1
fi
done
echo "[start_all] Services:"
$DC -f "$COMPOSE_FILE" ps
echo "[start_all] Logs (Ctrl+C to stop tailing)..."
$DC -f "$COMPOSE_FILE" logs -f web batch_worker prediction_worker