refactor: simplify dependency installation to use central requirements.txt only
Dependency Installation Simplification - Complete: ✅ DEPENDENCY INSTALLATION SIMPLIFIED: Removed individual service installations, use central requirements.txt - setup.sh: Removed individual service dependency installations - setup.sh: Now installs all dependencies from /opt/aitbc/requirements.txt only - Reason: Central requirements.txt already contains all service dependencies - Impact: Simpler, faster, and more reliable setup process ✅ BEFORE vs AFTER: ❌ Before (Complex - Individual Installations): # Wallet service dependencies cd /opt/aitbc/apps/wallet pip install -r requirements.txt # Coordinator API dependencies cd /opt/aitbc/apps/coordinator-api pip install -r requirements.txt # Exchange API dependencies cd /opt/aitbc/apps/exchange pip install -r requirements.txt ✅ After (Simple - Central Installation): # Install all dependencies from central requirements.txt pip install -r /opt/aitbc/requirements.txt ✅ CENTRAL REQUIREMENTS ANALYSIS: 📦 /opt/aitbc/requirements.txt: Contains all service dependencies 📋 Content: FastAPI, SQLAlchemy, Pydantic, Uvicorn, etc. 🎯 Purpose: Single source of truth for all Python dependencies 📁 Coverage: All services covered in central requirements file ✅ SIMPLIFICATION BENEFITS: ✅ Single Installation: One pip install command instead of multiple ✅ Faster Setup: No directory changes between installations ✅ Consistency: All services use same dependency versions ✅ Reliability: Single point of failure instead of multiple ✅ Maintenance: Only one requirements file to maintain ✅ No Conflicts: No version conflicts between services ✅ REMOVED COMPLEXITY: 🗑️ Individual service directory navigation 🗑️ Multiple pip install commands 🗑️ Service-specific fallback packages 🗑️ Duplicate dependency installations 🗑️ Complex error handling per service ✅ IMPROVED SETUP FLOW: 1. Create/activate central virtual environment 2. Install all dependencies from requirements.txt 3. Complete setup (no individual service setup needed) 4. All services ready with same dependencies ✅ TECHNICAL ADVANTAGES: ✅ Dependency Resolution: Single dependency resolution process ✅ Version Consistency: All services use exact same versions ✅ Cache Efficiency: Better pip cache utilization ✅ Disk Space: No duplicate package installations ✅ Update Simplicity: Update one file, reinstall once ✅ ERROR HANDLING: ✅ Simple Validation: Check for main requirements.txt only ✅ Clear Error: "Main requirements.txt not found" ✅ Single Point: One file to validate instead of multiple ✅ Easier Debugging: Single installation process to debug RESULT: Successfully simplified dependency installation to use central requirements.txt only, eliminating complex individual service installations and providing a cleaner, faster, and more reliable setup process.
This commit is contained in:
37
setup.sh
37
setup.sh
@@ -135,44 +135,19 @@ setup_venvs() {
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
|
||||
# Install main requirements
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r requirements.txt
|
||||
fi
|
||||
else
|
||||
log "Central virtual environment already exists, activating..."
|
||||
source /opt/aitbc/venv/bin/activate
|
||||
fi
|
||||
|
||||
# Install service dependencies in central venv
|
||||
log "Installing service dependencies..."
|
||||
# Install all dependencies from central requirements.txt
|
||||
log "Installing all dependencies from central requirements.txt..."
|
||||
|
||||
# Wallet service dependencies
|
||||
log "Installing wallet service dependencies..."
|
||||
cd /opt/aitbc/apps/wallet
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r requirements.txt
|
||||
# Install main requirements (contains all service dependencies)
|
||||
if [ -f "/opt/aitbc/requirements.txt" ]; then
|
||||
pip install -r /opt/aitbc/requirements.txt
|
||||
else
|
||||
pip install fastapi uvicorn pydantic httpx python-dotenv websockets
|
||||
fi
|
||||
|
||||
# Coordinator API dependencies
|
||||
log "Installing coordinator API dependencies..."
|
||||
cd /opt/aitbc/apps/coordinator-api
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
pip install fastapi uvicorn pydantic httpx python-dotenv
|
||||
fi
|
||||
|
||||
# Exchange API dependencies
|
||||
log "Installing exchange API dependencies..."
|
||||
cd /opt/aitbc/apps/exchange
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
pip install fastapi uvicorn pydantic python-multipart
|
||||
error "Main requirements.txt not found"
|
||||
fi
|
||||
|
||||
success "Virtual environments setup completed"
|
||||
|
||||
Reference in New Issue
Block a user