Spaces:
Paused
Paused
File size: 2,095 Bytes
5eb4857 | 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 | #!/bin/bash
# Nexus AI Platform Setup Script (Linux/macOS Bash)
# This script initializes the environment, installs dependencies, and seeds the database.
echo -e "\033[0;36m--- Nexus AI Platform Setup ---\033[0m"
# 1. Dependency Checks
echo -e "\n\033[0;33m[1/4] Checking Dependencies...\033[0m"
if ! command -v python3 &> /dev/null; then
echo -e "\033[0;31m❌ Python 3 is not installed or not in PATH.\033[0m"
exit 1
fi
if ! command -v docker &> /dev/null; then
echo -e "\033[0;31m❌ Docker is not installed or not in PATH.\033[0m"
exit 1
fi
echo -e "\033[0;32m✅ Dependencies OK.\033[0m"
# 2. Python Environment & Requirements
echo -e "\n\033[0;33m[2/4] Installing Python Requirements...\033[0m"
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo -e "\033[0;31m❌ Failed to install requirements.\033[0m"
exit 1
fi
echo -e "\033[0;32m✅ Requirements installed.\033[0m"
# 3. Infrastructure (Docker)
echo -e "\n\033[0;33m[3/4] Starting Infrastructure (Postgres, Redis)...\033[0m"
docker-compose up -d
if [ $? -ne 0 ]; then
echo -e "\033[0;31m❌ Failed to start docker-compose services.\033[0m"
exit 1
fi
echo -e "\033[0;36m⏳ Waiting 10 seconds for services to initialize...\033[0m"
sleep 10
echo -e "\033[0;32m✅ Infrastructure ready.\033[0m"
# 4. Database Seeding
echo -e "\n\033[0;33m[4/4] Seeding Database...\033[0m"
export PYTHONPATH=.
python3 seeds/seed_data.py
if [ $? -ne 0 ]; then
echo -e "\033[0;31m❌ Database seeding failed.\033[0m"
exit 1
fi
echo -e "\033[0;32m✅ Database initialized with seed data.\033[0m"
# 🏁 Final Instructions
echo -e "\n\033[0;36m--- Setup Complete! ---\033[0m"
echo -e "\033[0;37mTo run the system, open two terminals and run the following:\033[0m"
echo -e "\n\033[0;32m1. Start the Task Worker:\033[0m"
echo -e " arq worker.WorkerSettings"
echo -e "\n\033[0;32m2. Start the API Server:\033[0m"
echo -e " uvicorn main:app --reload"
echo -e "\n\033[0;90mWait for the worker to show 'Worker starting' before using automated features.\033[0m"
|