-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
70 lines (61 loc) · 1.74 KB
/
setup.sh
File metadata and controls
70 lines (61 loc) · 1.74 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
#!/bin/bash
echo "🚀 ReachInBox AI - Phase 1 Setup Script"
echo "========================================"
echo ""
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker Desktop first."
exit 1
fi
echo "✓ Docker is running"
echo ""
# Check if .env file exists
if [ ! -f "backend/.env" ]; then
echo "⚠️ .env file not found. Creating from template..."
cp backend/.env.example backend/.env
echo "✓ Created backend/.env"
echo ""
echo "📝 IMPORTANT: Please edit backend/.env and add your:"
echo " - Email account credentials (at least 2 accounts)"
echo " - Gemini API key (get from https://aistudio.google.com/app/apikey)"
echo ""
echo "See backend/.env.example for detailed instructions."
echo ""
read -p "Press Enter after you've configured backend/.env..."
fi
# Start Elasticsearch
echo ""
echo "🐳 Starting Elasticsearch container..."
docker-compose up -d
echo ""
echo "⏳ Waiting for Elasticsearch to be ready..."
sleep 5
# Check Elasticsearch
for i in {1..10}; do
if curl -s http://localhost:9200 > /dev/null 2>&1; then
echo "✓ Elasticsearch is ready!"
break
fi
if [ $i -eq 10 ]; then
echo "❌ Elasticsearch did not start. Please check Docker logs:"
echo " docker logs reachinbox-elasticsearch"
exit 1
fi
echo " Attempt $i/10..."
sleep 3
done
# Install backend dependencies
echo ""
echo "📦 Installing backend dependencies..."
cd backend
npm install
echo ""
echo "✅ Setup complete!"
echo ""
echo "To start the email sync service:"
echo " cd backend"
echo " npm run dev"
echo ""
echo "Then test it:"
echo " curl http://localhost:3001/api/health"
echo ""