Universities commited on
Commit
d4f773b
·
verified ·
1 Parent(s): 9d004fc

Delete start.sh

Browse files
Files changed (1) hide show
  1. start.sh +0 -101
start.sh DELETED
@@ -1,101 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- echo "=========================================="
5
- echo " ResearchOS MVP - Hugging Face Spaces"
6
- echo "=========================================="
7
-
8
- # Initialize SQLite database
9
- echo "[1/9] Initializing SQLite database..."
10
- python3 << 'PYEOF'
11
- import os
12
- from sqlalchemy import create_engine
13
-
14
- # Import all model bases
15
- import sys
16
- sys.path.insert(0, '/app')
17
-
18
- # Create engine
19
- engine = create_engine('sqlite:///app/researchos.db', echo=False)
20
-
21
- # Create tables by importing main modules
22
- from services.auth_service.src.main import Base as AuthBase
23
- from services.project_service.src.main import Base as ProjectBase
24
- from services.manuscript_service.src.main import Base as ManuscriptBase
25
- from services.verification_service.src.main import Base as VerificationBase
26
-
27
- AuthBase.metadata.create_all(engine)
28
- ProjectBase.metadata.create_all(engine)
29
- ManuscriptBase.metadata.create_all(engine)
30
- VerificationBase.metadata.create_all(engine)
31
-
32
- print("Database initialized successfully")
33
- PYEOF
34
-
35
- # Function to start a service
36
- start_service() {
37
- local name=$1
38
- local port=$2
39
- local cmd=$3
40
- echo "[START] $name on port $port..."
41
- eval "$cmd > /tmp/$name.log 2>&1 &"
42
- echo $! > /tmp/$name.pid
43
- }
44
-
45
- # Start all backend services
46
- start_service "auth-service" "8005" "python3 services/auth-service/src/main.py"
47
- start_service "project-service" "8002" "python3 services/project-service/src/main.py"
48
- start_service "manuscript-service" "8007" "python3 services/manuscript-service/src/main.py"
49
- start_service "analysis-service" "8001" "python3 services/analysis-service/src/main.py"
50
- start_service "agent-service" "8004" "python3 services/agent-service/src/main.py"
51
- start_service "verification-service" "8006" "python3 services/verification-service/src/main.py"
52
-
53
- # Wait for services to be ready
54
- echo "[2/9] Waiting for services to boot..."
55
- sleep 5
56
-
57
- # Start API Gateway
58
- start_service "api-gateway" "8000" "python3 services/api-gateway/src/main.py"
59
-
60
- sleep 3
61
-
62
- # Start Next.js frontend on port 7860 (HF Spaces requirement)
63
- echo "[3/9] Starting Next.js frontend on port 7860..."
64
- cd /app/apps/web && PORT=7860 node server.js > /tmp/web.log 2>&1 &
65
- echo $! > /tmp/web.pid
66
-
67
- echo ""
68
- echo "=========================================="
69
- echo " ResearchOS is starting up!"
70
- echo "=========================================="
71
- echo ""
72
- echo "Services:"
73
- echo " - Auth: http://localhost:8005"
74
- echo " - Projects: http://localhost:8002"
75
- echo " - Manuscripts: http://localhost:8007"
76
- echo " - Analysis: http://localhost:8001"
77
- echo " - Agents: http://localhost:8004"
78
- echo " - Verification:http://localhost:8006"
79
- echo " - API Gateway: http://localhost:8000"
80
- echo " - Web App: http://localhost:7860"
81
- echo ""
82
- echo "Logs available in /tmp/*.log"
83
- echo ""
84
-
85
- # Health check loop
86
- for i in {1..30}; do
87
- if curl -s http://localhost:8000/health > /dev/null 2>&1; then
88
- echo "[✓] API Gateway is ready!"
89
- break
90
- fi
91
- echo "[...] Waiting for API Gateway ($i/30)..."
92
- sleep 2
93
- done
94
-
95
- echo ""
96
- echo "=========================================="
97
- echo " ResearchOS is LIVE!"
98
- echo "=========================================="
99
-
100
- # Keep container alive and stream logs
101
- tail -f /tmp/web.log /tmp/api-gateway.log 2>/dev/null || wait