deployment-taskflow / deploy.sh
Tripagra
Add deployment solution: FastAPI/uvicorn + Render config + deployment guides
42f628f
Raw
History Blame Contribute Delete
4.46 kB
#!/bin/bash
# Smart Escalation API - Deployment Script
# This script helps you deploy the application using the hybrid approach
set -e
echo "πŸš€ Smart Escalation API - Deployment Helper"
echo "============================================"
echo ""
# Check if git is clean
if [[ -n $(git status -s) ]]; then
echo "⚠️ You have uncommitted changes. Commit them first:"
echo ""
git status -s
echo ""
read -p "Commit changes now? (y/n) " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
git add .
read -p "Enter commit message: " commit_msg
git commit -m "$commit_msg"
echo "βœ… Changes committed"
else
echo "❌ Please commit changes before deploying"
exit 1
fi
fi
echo ""
echo "πŸ“¦ Deployment Options:"
echo "1. Deploy Backend to Render (recommended)"
echo "2. Deploy Frontend to Vercel"
echo "3. Deploy Both (Backend β†’ Render, Frontend β†’ Vercel)"
echo ""
read -p "Choose option (1-3): " option
case $option in
1)
echo ""
echo "πŸ”§ Deploying Backend to Render..."
echo ""
echo "Steps:"
echo "1. Push your code to GitHub:"
git push
echo " βœ… Code pushed to GitHub"
echo ""
echo "2. Go to https://dashboard.render.com"
echo "3. Click 'New +' β†’ 'Web Service'"
echo "4. Connect your GitHub repository"
echo "5. Render will auto-detect render.yaml"
echo "6. Add your GOOGLE_API_KEY in environment variables"
echo "7. Click 'Create Web Service'"
echo ""
echo "⏳ Deployment will take 5-10 minutes (downloading ML models)"
echo ""
echo "After deployment:"
echo "- Copy your backend URL (e.g., https://your-app.onrender.com)"
echo "- Add VITE_API_URL environment variable in Vercel"
echo "- Redeploy frontend"
;;
2)
echo ""
echo "πŸ”§ Deploying Frontend to Vercel..."
echo ""
echo "Steps:"
echo "1. Push your code to GitHub:"
git push
echo " βœ… Code pushed to GitHub"
echo ""
echo "2. Go to https://vercel.com/dashboard"
echo "3. Import your GitHub repository"
echo "4. Configure:"
echo " - Framework Preset: Vite"
echo " - Root Directory: frontend"
echo " - Build Command: npm run build"
echo " - Output Directory: dist"
echo "5. Add environment variable:"
echo " - VITE_API_URL = https://your-backend.onrender.com"
echo "6. Deploy"
echo ""
echo "βœ… Frontend will be live in ~2 minutes"
;;
3)
echo ""
echo "πŸ”§ Deploying Full Stack..."
echo ""
git push
echo "βœ… Code pushed to GitHub"
echo ""
echo "πŸ“‹ Follow these steps:"
echo ""
echo "STEP 1: Deploy Backend to Render"
echo "--------------------------------"
echo "1. Go to https://dashboard.render.com"
echo "2. Click 'New +' β†’ 'Web Service'"
echo "3. Connect your GitHub repository"
echo "4. Render will auto-detect render.yaml"
echo "5. Add GOOGLE_API_KEY in environment variables"
echo "6. Click 'Create Web Service'"
echo "7. Wait for deployment (5-10 minutes)"
echo "8. Copy your backend URL"
echo ""
echo "STEP 2: Deploy Frontend to Vercel"
echo "---------------------------------"
echo "1. Go to https://vercel.com/dashboard"
echo "2. Import your GitHub repository"
echo "3. Configure:"
echo " - Framework Preset: Vite"
echo " - Root Directory: frontend"
echo " - Build Command: npm run build"
echo " - Output Directory: dist"
echo "4. Add environment variable:"
echo " - VITE_API_URL = [YOUR_RENDER_BACKEND_URL]"
echo "5. Deploy"
echo ""
echo "STEP 3: Test"
echo "------------"
echo "1. Visit your Vercel frontend URL"
echo "2. Ask a question"
echo "3. Verify it connects to your Render backend"
echo ""
echo "βœ… Full deployment complete!"
;;
*)
echo "❌ Invalid option"
exit 1
;;
esac
echo ""
echo "πŸ“š For detailed instructions, see:"
echo " - DEPLOYMENT_OPTIONS.md (overview)"
echo " - BACKEND_DEPLOY.md (Render setup)"
echo " - README.md (general setup)"