-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_local.sh
More file actions
executable file
·97 lines (83 loc) · 2.46 KB
/
start_local.sh
File metadata and controls
executable file
·97 lines (83 loc) · 2.46 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# Start all Biotact services locally
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
NC='\033[0m'
echo "=========================================="
echo " Starting Biotact Services Locally "
echo "=========================================="
echo ""
# Function to check if service is running
check_service() {
if pgrep -x "$1" > /dev/null; then
return 0
else
return 1
fi
}
# Check PostgreSQL
echo -n "Checking PostgreSQL... "
if systemctl is-active --quiet postgresql; then
echo -e "${GREEN}✓ Running${NC}"
else
echo -e "${YELLOW}Starting...${NC}"
sudo systemctl start postgresql
fi
# Check Redis
echo -n "Checking Redis... "
if systemctl is-active --quiet redis-server; then
echo -e "${GREEN}✓ Running${NC}"
else
echo -e "${YELLOW}Starting...${NC}"
sudo systemctl start redis-server
fi
# Start Qdrant in background
echo -n "Checking Qdrant... "
if lsof -i:6333 > /dev/null 2>&1; then
echo -e "${GREEN}✓ Running${NC}"
else
echo -e "${YELLOW}Starting...${NC}"
# Start Qdrant in background with reduced memory
nohup ~/qdrant --storage-path ~/qdrant-storage \
--max-memory 512 \
--log-level info \
> logs/qdrant.log 2>&1 &
echo "Qdrant PID: $!"
sleep 3
fi
# Activate virtual environment
echo -n "Activating Python environment... "
source venv/bin/activate
echo -e "${GREEN}✓${NC}"
# Start backend
echo ""
echo -e "${GREEN}Starting Backend API...${NC}"
echo "----------------------------------------"
# Export environment variables
export PYTHONPATH=/home/$USER/project/biotact-production/backend:$PYTHONPATH
export DATABASE_URL="postgresql://biotact_admin:biotact_password@localhost:5432/biotact_production"
export REDIS_URL="redis://localhost:6379/0"
export QDRANT_URL="http://localhost:6333"
# Check if .env file exists
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
echo -e "${GREEN}✓ Environment variables loaded${NC}"
else
echo -e "${RED}Warning: .env file not found!${NC}"
echo "Copy .env.example to .env and configure API keys"
fi
# Start the backend with Uvicorn (development mode)
echo ""
echo "Starting FastAPI backend..."
echo "API will be available at: http://localhost:8000"
echo "API docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop all services"
echo "----------------------------------------"
cd backend
uvicorn app.main:app \
--host 0.0.0.0 \
--port 8000 \
--reload \
--log-level info