Spaces:
3SCError404
/
Paused

nexus / scripts /setup.sh
dushyantsingh0
Beta 1.0: Pure Backend Release (Excluding Frontend)
5eb4857
Raw History Blame Contribute Delete
2.1 kB
#!/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"