-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
66 lines (54 loc) · 2.06 KB
/
Copy pathstart.sh
File metadata and controls
66 lines (54 loc) · 2.06 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
#!/bin/bash
# =========================================
# OpenSanctions Full Pipeline Starter (bash)
# =========================================
# 실행 흐름:
# 1. DB 초기화 (PostgreSQL)
# 2. Zavod ETL 전체 자동화 (crawl → export → load-db)
# 3. Zavod UI 구동
# =========================================
set -e
DATASET=${1:-datasets/nl/terrorism_list/nl_terrorism_list.yml}
echo "🚀 Starting OpenSanctions full environment..."
echo "--------------------------------------------"
if grep -qi microsoft /proc/version 2>/dev/null; then
echo "🧩 WSL detected: Docker Desktop WSL integration or Docker Engine must be running."
echo " Tip: keep the repo under /home to avoid slow Windows filesystem mounts."
fi
export LOCAL_UID="$(id -u)"
export LOCAL_GID="$(id -g)"
# 1️⃣ 기존 컨테이너 종료 및 정리
echo "🧹 Stopping and removing existing containers..."
docker compose down -v || true
# 2️⃣ DB 컨테이너 빌드 및 실행
echo "🛠️ Building and starting database container..."
docker compose up -d --build db
echo "⏳ Waiting for database to become healthy..."
sleep 15
# 3️⃣ Zavod ETL 전체 자동 실행
echo "⚙️ Running Zavod ETL (crawl → export → load-db)..."
docker compose run --rm zavod bash -c "
export DATABASE_URL=postgresql://postgres:password@db:5432/dev &&
echo '🛰️ Crawling dataset: $DATASET' &&
zavod crawl $DATASET &&
echo '📦 Exporting dataset...' &&
zavod export $DATASET &&
echo '💾 Loading into Postgres...' &&
zavod load-db $DATASET &&
echo '✅ ETL pipeline completed successfully!'
"
# 4️⃣ Zavod UI 구동
echo "🌐 Starting Zavod UI..."
docker compose up -d web
# 5️⃣ 상태 표시
echo ""
echo "--------------------------------------------"
echo "✅ All systems are up and running!"
echo " - PostgreSQL: localhost:5432"
echo " - Zavod UI: http://localhost:3000"
echo " - Dataset: $DATASET"
echo "--------------------------------------------"
# 6️⃣ 실시간 로그 보기
echo ""
echo "📜 Showing live logs for Zavod UI..."
docker compose logs -f web