#!/bin/bash # Setup script for AudioForge backend set -e echo "🎵 AudioForge Backend Setup" echo "============================" # Check Python version python_version=$(python3 --version 2>&1 | awk '{print $2}') echo "Python version: $python_version" # Create virtual environment if [ ! -d ".venv" ]; then echo "Creating virtual environment..." python3 -m venv .venv fi # Activate virtual environment echo "Activating virtual environment..." source .venv/bin/activate # Install uv if not present if ! command -v uv &> /dev/null; then echo "Installing uv..." pip install uv fi # Install dependencies echo "Installing dependencies..." uv pip install -e ".[dev]" # Create .env file if it doesn't exist if [ ! -f ".env" ]; then echo "Creating .env file from .env.example..." cp .env.example .env echo "⚠️ Please edit .env with your database and Redis settings" fi # Create storage directories echo "Creating storage directories..." mkdir -p storage/audio/{music,vocals,mixed,mastered} # Check if PostgreSQL is running echo "Checking PostgreSQL connection..." if command -v psql &> /dev/null; then echo "PostgreSQL client found. Please ensure PostgreSQL is running." else echo "⚠️ PostgreSQL client not found. Please install PostgreSQL." fi # Check if Redis is running echo "Checking Redis connection..." if command -v redis-cli &> /dev/null; then redis-cli ping > /dev/null 2>&1 && echo "✅ Redis is running" || echo "⚠️ Redis is not running" else echo "⚠️ Redis client not found. Please install Redis." fi echo "" echo "✅ Setup complete!" echo "" echo "Next steps:" echo "1. Edit .env with your database and Redis URLs" echo "2. Start PostgreSQL and Redis" echo "3. Run: alembic upgrade head" echo "4. Run: uvicorn app.main:app --reload"