open-notebook / DEPLOY_NOW.md
baveshraam's picture
FIX: SurrealDB 2.0 migration syntax and Frontend/CORS link
f871fed
# 🎯 DEPLOY NOW - Everything Ready!
## βœ… What's Configured
I've set up everything to work exactly like your localhost, using your FREE API keys:
- βœ… **Groq API**: `gsk_3pLc...kvfC` - For chat, transformations, insights
- βœ… **Gemini API**: `AIzaS...ep_0` - For embeddings, search, long context
- βœ… **Database**: test namespace/database (same as localhost)
- βœ… **All settings**: Same retry/worker config as your working setup
---
## πŸš€ STEP 1: Copy Railway Variables
Go to Railway Dashboard β†’ Your Service β†’ Variables, and paste ALL of these:
```plaintext
SURREAL_URL=ws://127.0.0.1:8000/rpc
SURREAL_USER=root
SURREAL_PASSWORD=root
SURREAL_NAMESPACE=test
SURREAL_DATABASE=test
INTERNAL_API_URL=http://127.0.0.1:5055
API_URL=http://localhost:5055
SURREAL_COMMANDS_MAX_TASKS=5
SURREAL_COMMANDS_RETRY_ENABLED=true
SURREAL_COMMANDS_RETRY_MAX_ATTEMPTS=3
SURREAL_COMMANDS_RETRY_WAIT_STRATEGY=exponential_jitter
SURREAL_COMMANDS_RETRY_WAIT_MIN=1
SURREAL_COMMANDS_RETRY_WAIT_MAX=30
GROQ_API_KEY=<YOUR_GROQ_KEY_HERE>
GOOGLE_API_KEY=<YOUR_GEMINI_KEY_HERE>
```
**Note**: We'll update `API_URL` after first deploy.
---
## πŸš€ STEP 2: Push Code
```powershell
cd c:\sem6-real\studyrocket\notebookllm\open-notebook
git add .
git commit -m "Add Railway deployment with FREE tier (Groq + Gemini)"
git push origin main
```
---
## πŸš€ STEP 3: Wait for Deploy
Railway will:
1. Build the Docker image (~5-10 minutes)
2. Start all services (SurrealDB, API, Worker, Frontend)
3. Run migrations (0 β†’ 18)
4. Expose your app on a public URL
**Watch the logs** in Railway dashboard for:
```
βœ“ Ready in XXXms
INFO: Application startup complete
Migrations completed successfully. Database is now at version 18
```
---
## πŸš€ STEP 4: Update API_URL
1. Find your Railway domain in the dashboard (e.g., `https://se-production-1a2b.up.railway.app`)
2. Update the `API_URL` variable:
```plaintext
API_URL=https://se-production-1a2b.up.railway.app
```
3. Railway will auto-redeploy (~1 minute)
---
## βœ… STEP 5: Test Everything
Visit your app: `https://your-railway-domain.up.railway.app`
**Test these features:**
- βœ… Create a notebook
- βœ… Upload a document (tests embeddings)
- βœ… Search documents (tests Gemini embeddings)
- βœ… Chat with documents (tests Groq LLM)
- βœ… Generate insights (tests transformations)
- βœ… Create notes
**Skip for now:**
- ⏸️ Podcast generation (you'll configure later)
---
## πŸŽ‰ What You'll Have
### Working Features (FREE):
- βœ… Chat using Groq Llama 3.1 70B
- βœ… Document embeddings using Gemini
- βœ… Semantic search using Gemini
- βœ… Transformations using Groq
- βœ… Insights using Groq
- βœ… Long context (1M tokens!) using Gemini
- βœ… All for **$0/month** (AI costs)
### Railway Costs:
- First month: **FREE** ($5 credit)
- After: **$5-10/month** (just hosting)
---
## πŸ”§ Models Available
In the UI, you can select from:
### Groq Models (FREE):
- `llama-3.1-70b-versatile` - Best for complex tasks
- `llama-3.1-8b-instant` - Fast for simple tasks
- `mixtral-8x7b-32768` - Alternative option
### Gemini Models (FREE):
- `gemini-1.5-flash` - Fast, FREE
- `gemini-1.5-pro` - 1M context, FREE tier
- `text-embedding-004` - Embeddings
---
## πŸ†˜ If Something Goes Wrong
### Build Fails
β†’ Check Railway logs for error message
β†’ Ensure all files are committed (especially migrations/18.surrealql)
### Services Won't Start
β†’ Check `SURREAL_URL=ws://127.0.0.1:8000/rpc` (not localhost!)
β†’ Verify both API keys are set correctly
### Can't Access App
β†’ Wait 2-3 minutes after deploy
β†’ Check `API_URL` is set to your Railway domain
β†’ Try incognito/private browser window
### Features Don't Work
β†’ Groq models: Check chat works in UI
β†’ Gemini embeddings: Try uploading a document
β†’ If API key issues: Regenerate keys at provider dashboards
---
## πŸ“Š Your Setup Summary
| Component | Configuration | Status |
|-----------|--------------|--------|
| **Database** | SurrealDB (embedded) | βœ… Ready |
| **API** | FastAPI on port 5055 | βœ… Ready |
| **Frontend** | Next.js on port 8080 | βœ… Ready |
| **Worker** | Background tasks | βœ… Ready |
| **LLM** | Groq Llama 3.1 | βœ… FREE |
| **Embeddings** | Gemini | βœ… FREE |
| **Hosting** | Railway | βœ… $5-10/mo |
| **Podcasts** | Not configured | ⏸️ Later |
---
## 🎊 Next Steps After Deploy
1. βœ… Test all features (except podcasts)
2. βœ… Upload some test documents
3. βœ… Try searching and chatting
4. βœ… Generate some insights
5. ⏸️ Configure podcasts later when needed
---
## πŸ’° Cost Tracking
Track your FREE tier usage:
- **Groq**: https://console.groq.com/dashboard
- **Gemini**: https://console.cloud.google.com/apis/dashboard
- **Railway**: https://railway.app/dashboard
All providers show FREE tier limits and usage!
---
## πŸš€ Ready to Deploy!
Everything is configured. Just run:
```powershell
git add .
git commit -m "Railway deployment ready with FREE tier keys"
git push origin main
```
Then watch Railway build and deploy! πŸŽ‰
---
**Questions?** Everything should work exactly like your localhost setup, but on Railway! The same models, same features (minus podcasts), all working with your FREE API keys.