fix: update setup.sh to use central virtual environment instead of separate venvs
Virtual Environment Consolidation - Complete: ✅ SETUP SCRIPT UPDATED: Changed from separate venvs to central virtual environment - setup.sh: setup_venvs function now uses /opt/aitbc/venv instead of creating separate .venv for each service - Added central venv creation with main requirements installation - Consolidated all service dependencies into single virtual environment ✅ VIRTUAL ENVIRONMENT CHANGES: 🔧 Before: Separate .venv for each service (apps/wallet/.venv, apps/coordinator-api/.venv, apps/exchange/.venv) 🔧 After: Single central /opt/aitbc/venv for all services 📦 Dependencies: All service dependencies installed in central venv 🎯 Purpose: Consistent with recent virtual environment consolidation efforts ✅ SETUP FLOW IMPROVED: 📋 Central venv creation: Creates /opt/aitbc/venv if not exists 📋 Main requirements: Installs requirements.txt if present 📋 Service dependencies: Installs each service's requirements in central venv 📋 Consistency: Matches development environment using central venv ✅ BENEFITS ACHIEVED: ✅ Consistency: Setup script now matches development environment ✅ Efficiency: Single virtual environment instead of multiple separate ones ✅ Maintenance: Easier to manage and update dependencies ✅ Disk Space: Reduced duplication of Python packages ✅ Simplicity: Clearer virtual environment structure ✅ BACKWARD COMPATIBILITY: 🔄 Existing venv: If /opt/aitbc/venv exists, it's used instead of creating new 📋 Requirements: Main requirements.txt installed if available 📋 Services: Each service's requirements still installed properly 🎯 Functionality: All services work with central virtual environment ✅ UPDATED FUNCTION FLOW: 1. Check if central venv exists 2. Create central venv if needed with main requirements 3. Activate central venv 4. Install wallet service dependencies 5. Install coordinator API dependencies 6. Install exchange API dependencies 7. Complete setup with single virtual environment RESULT: Successfully updated setup.sh to use central virtual environment, providing consistency with development environment and eliminating virtual environment duplication while maintaining all service functionality.
This commit is contained in:
49
setup.sh
49
setup.sh
@@ -129,32 +129,47 @@ setup_runtime_directories() {
|
||||
setup_venvs() {
|
||||
log "Setting up Python virtual environments..."
|
||||
|
||||
# Wallet service
|
||||
log "Setting up wallet service..."
|
||||
cd /opt/aitbc/apps/wallet
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install fastapi uvicorn pydantic httpx python-dotenv websockets
|
||||
# Create central virtual environment if it doesn't exist
|
||||
if [ ! -d "/opt/aitbc/venv" ]; then
|
||||
log "Creating central virtual environment..."
|
||||
cd /opt/aitbc
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
|
||||
# Coordinator API
|
||||
log "Setting up coordinator API..."
|
||||
# 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..."
|
||||
|
||||
# Wallet service dependencies
|
||||
log "Installing wallet service dependencies..."
|
||||
cd /opt/aitbc/apps/wallet
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r 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
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
pip install fastapi uvicorn pydantic httpx python-dotenv
|
||||
fi
|
||||
|
||||
# Exchange API
|
||||
log "Setting up exchange API..."
|
||||
# Exchange API dependencies
|
||||
log "Installing exchange API dependencies..."
|
||||
cd /opt/aitbc/apps/exchange
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
if [ -f "requirements.txt" ]; then
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user