Spaces:
Sleeping
Sleeping
File size: 4,460 Bytes
42f628f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/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)"
|