setup.sh
1.91 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
#!/bin/bash
# saas-search Setup and Startup Script
# This script sets up the environment and starts all services
set -e # Exit on error
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN}saas-search Setup Script${NC}"
echo -e "${GREEN}========================================${NC}"
# Change to project directory
cd "$(dirname "$0")"
PROJECT_ROOT=$(pwd)
echo -e "\n${YELLOW}Step 1: Setting up Python environment (venv preferred)${NC}"
if [ ! -f "${PROJECT_ROOT}/.venv/bin/activate" ]; then
echo -e "${YELLOW}Creating venv and installing dependencies...${NC}"
./scripts/create_venv.sh
fi
# Activate environment + load .env
source ./activate.sh
# Verify environment
echo -e "\n${YELLOW}Current Python version:${NC}"
python --version
echo -e "\n${YELLOW}Step 2: Loading configuration${NC}"
./scripts/init_env.sh
# Display configuration
echo -e "${GREEN}Configuration loaded:${NC}"
python -c "from config.env_config import print_config; print_config()"
echo -e "\n${YELLOW}Step 3: Checking Elasticsearch connection${NC}"
python -c "
from config.env_config import get_es_config
from utils.es_client import ESClient
es_config = get_es_config()
client = ESClient(hosts=[es_config['host']], username=es_config.get('username'), password=es_config.get('password'))
if client.ping():
print('✓ Elasticsearch is reachable')
else:
print('✗ Elasticsearch connection failed')
exit(1)
"
echo -e "\n${GREEN}========================================${NC}"
echo -e "${GREEN}Setup Complete!${NC}"
echo -e "${GREEN}========================================${NC}"
echo ""
echo -e "Next steps:"
echo -e " 1. Start backend: ${YELLOW}./scripts/start_backend.sh${NC}"
echo -e " 2. Start indexer: ${YELLOW}./scripts/start_indexer.sh${NC}"
echo -e " 3. Start frontend: ${YELLOW}./scripts/start_frontend.sh${NC}"
echo ""