-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·138 lines (111 loc) · 3.74 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·138 lines (111 loc) · 3.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
# GraphRAG Chatbot Setup Script
# This script helps set up the project for local development
set -e
echo "🚀 GraphRAG Chatbot Setup Script"
echo "=================================="
# Check if required tools are installed
check_dependencies() {
echo "📋 Checking dependencies..."
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
if ! command -v gcloud &> /dev/null; then
echo "⚠️ gcloud CLI is not installed. This is required for GCP deployment."
echo " You can still run locally, but won't be able to deploy to GCP."
fi
echo "✅ Dependencies check complete!"
}
# Create environment file if it doesn't exist
setup_env() {
echo "🔧 Setting up environment configuration..."
if [ ! -f .env ]; then
cp .env.example .env
echo "✅ Created .env file from .env.example"
echo "⚠️ Please edit .env with your actual values before running the application"
else
echo "✅ .env file already exists"
fi
}
# Check for service account key
check_service_account() {
echo "🔑 Checking for service account key..."
if [ ! -f GraphRAG-IAM-Admin.json ]; then
echo "⚠️ GraphRAG-IAM-Admin.json not found"
echo " Please place your Google Cloud service account key file in the root directory"
echo " This file is required for authentication with Google Cloud services"
else
echo "✅ Service account key found"
fi
}
# Pull Docker images (optional, for faster startup)
pull_images() {
echo "🐳 Pulling base Docker images (this may take a while)..."
docker pull node:18-alpine
docker pull python:3.11-slim
echo "✅ Base images pulled successfully"
}
# Build and start services
start_services() {
echo "🚀 Building and starting services..."
# Build images
docker-compose build
# Start services
docker-compose up -d
echo "✅ Services started successfully!"
echo ""
echo "🌐 Application URLs:"
echo " Frontend: http://localhost:3000"
echo " Backend: http://localhost:8000"
echo " API Docs: http://localhost:8000/docs"
echo ""
echo "📊 To view logs:"
echo " docker-compose logs -f"
echo ""
echo "🛑 To stop services:"
echo " docker-compose down"
}
# Main setup flow
main() {
echo "Starting GraphRAG Chatbot setup..."
echo ""
check_dependencies
echo ""
setup_env
echo ""
check_service_account
echo ""
# Ask user if they want to pull images
read -p "📥 Do you want to pull base Docker images now? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
pull_images
echo ""
fi
# Ask user if they want to start services
read -p "🚀 Do you want to build and start the services now? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
start_services
else
echo "⏸️ Skipping service startup"
echo " To start services later, run: docker-compose up -d"
fi
echo ""
echo "🎉 Setup complete!"
echo ""
echo "📖 Next steps:"
echo " 1. Edit .env with your Google Cloud configuration"
echo " 2. Place GraphRAG-IAM-Admin.json in the root directory"
echo " 3. Run 'docker-compose up -d' to start the services"
echo " 4. Visit http://localhost:3000 to use the application"
echo ""
echo "📚 For more information, see the README.md file"
}
# Run main function
main "$@"