#!/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 ""