mirror of
https://github.com/escalante29/healthy-fit.git
synced 2026-03-21 09:08:46 +01:00
Introduces DSPy-based nutrition and plan generation modules, including image analysis for nutritional info and personalized diet/exercise plans. Adds new API endpoints for health metrics/goals, nutrition image analysis, and plan management. Updates models, schemas, and backend structure to support these features, and includes initial training data and configuration for prompt optimization.
82 lines
1.8 KiB
Bash
Executable File
82 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Exit on error
|
|
set -e
|
|
|
|
# Load environment variables from .env
|
|
if [ -f .env ]; then
|
|
set -a
|
|
source .env
|
|
set +a
|
|
else
|
|
echo "Error: .env file not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Start Database container
|
|
echo "Starting database container..."
|
|
docker compose up -d db
|
|
|
|
echo "Waiting for database to be ready..."
|
|
until docker compose exec -T db pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}; do
|
|
echo "Database is unavailable - sleeping"
|
|
sleep 1
|
|
done
|
|
|
|
# Set DATABASE_URL for local connection (using mapped port 5435)
|
|
export DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5435/${POSTGRES_DB}"
|
|
echo "Configured DATABASE_URL for local development"
|
|
|
|
# Virtual Environment Setup
|
|
VENV_DIR="backend/.venv"
|
|
if [ ! -d "$VENV_DIR" ]; then
|
|
echo "Creating virtual environment in $VENV_DIR..."
|
|
python3 -m venv "$VENV_DIR"
|
|
fi
|
|
|
|
echo "Activating virtual environment..."
|
|
source "$VENV_DIR/bin/activate"
|
|
|
|
echo "Installing dependencies..."
|
|
pip install -r backend/requirements.txt
|
|
|
|
# Function to handle shutdown
|
|
cleanup() {
|
|
echo ""
|
|
echo "Stopping services..."
|
|
# Kill all child processes of this script
|
|
pkill -P $$
|
|
exit
|
|
}
|
|
|
|
echo "Running code formatting and linting..."
|
|
ruff format backend
|
|
ruff check backend --fix
|
|
|
|
echo "Installing dependencies..."
|
|
pip install -r backend/requirements.txt
|
|
|
|
|
|
# Trap signals for cleanup
|
|
trap cleanup SIGINT SIGTERM
|
|
|
|
echo "Starting Backend..."
|
|
# Run in background
|
|
(cd backend && uvicorn app.main:app --reload --host 0.0.0.0 --port 8000) &
|
|
|
|
echo "Starting Frontend..."
|
|
# Run in background
|
|
(cd frontend && npm run dev) &
|
|
|
|
# Wait for process to settle
|
|
sleep 2
|
|
|
|
echo ""
|
|
echo "Development environment running!"
|
|
echo "Backend: http://localhost:8000"
|
|
echo "Frontend: http://localhost:5173"
|
|
echo "Press Ctrl+C to stop"
|
|
|
|
# Wait indefinitely for background jobs
|
|
wait
|