#!/bin/bash set -e echo "🚀 Deploying Phase 2: Chore Management System" echo "==============================================" echo "" echo "📥 Step 1: Pulling latest changes..." git pull origin main echo "✅ Changes pulled" echo "" echo "🛑 Step 2: Stopping existing containers..." docker-compose down echo "✅ Containers stopped" echo "" echo "🔨 Step 3: Rebuilding containers (this may take a few minutes)..." docker-compose build --no-cache echo "✅ Containers rebuilt" echo "" echo "🚀 Step 4: Starting services..." docker-compose up -d echo "✅ Services started" echo "" echo "⏳ Step 5: Waiting for services to initialize (15 seconds)..." sleep 15 echo "" echo "🔍 Step 6: Checking service health..." echo "" echo "Backend Health:" curl -s http://localhost:8001/health | jq . || echo "Backend not responding yet" echo "" echo "Frontend Status:" curl -s http://localhost:5173 > /dev/null && echo "✅ Frontend is responding" || echo "❌ Frontend not responding yet" echo "" echo "📊 Step 7: Checking running containers..." docker-compose ps echo "" echo "==============================================" echo "🎉 Deployment Complete!" echo "==============================================" echo "" echo "📱 Access your Family Hub:" echo " Frontend: http://localhost:5173" echo " Backend API: http://localhost:8001" echo " API Docs: http://localhost:8001/docs" echo "" echo "🔑 Login with:" echo " Username: jess" echo " Password: password123" echo "" echo "📖 See PHASE2_README.md for full documentation" echo "" echo "💡 Tip: If login doesn't work immediately, wait another minute" echo " for the backend to fully initialize, then refresh the page."