open-navigator / website /docs /deployment /quickstart-databricks.md
jcbowyer's picture
Clean HuggingFace deployment without binary files
61d29fc
metadata
sidebar_position: 3

Quick Start Guide - React + FastAPI Databricks App

πŸš€ Deploy to Databricks Apps (5 minutes)

Prerequisites

  • Databricks workspace with Apps enabled
  • OpenAI API key

Steps

# 1. Set environment variables
export DATABRICKS_HOST=https://your-workspace.cloud.databricks.com
export DATABRICKS_TOKEN=dapi1234567890abcdef
export OPENAI_API_KEY=sk-...

# 2. Deploy!
./scripts/deploy-databricks-app.sh

# 3. Access your app
# https://your-workspace.cloud.databricks.com/apps/open-navigator

That's it! πŸŽ‰


πŸ’» Local Development (10 minutes)

Option A: Hot Reload (Recommended for UI development)

# Terminal 1 - Backend
source venv/bin/activate
uvicorn api.app:app --reload
# http://localhost:8000

# Terminal 2 - Frontend (hot reload!)
cd frontend
npm install
npm run dev
# http://localhost:3000

Option B: Production Mode (Test full build)

# Build frontend
cd frontend
npm install
npm run build
cd ..

# Run app
source venv/bin/activate
python scripts/test-app.py
# http://localhost:8000

πŸ“ Project Structure

open-navigator/
β”œβ”€β”€ frontend/                 # React app
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/           # Dashboard, Heatmap, etc.
β”‚   β”‚   └── components/      # Layout, etc.
β”‚   └── package.json
β”‚
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ app.py              # NEW: FastAPI for Databricks App
β”‚   └── main.py             # LEGACY: Original CLI API
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy-databricks-app.sh   # Deploy to cloud
β”‚   β”œβ”€β”€ setup-local.sh             # Setup dev environment
β”‚   └── test-app.py                # Test production build
β”‚
β”œβ”€β”€ app.yaml                # Databricks App config
└── Dockerfile.app          # Container image

🎯 Common Tasks

Deploy to Databricks

./scripts/deploy-databricks-app.sh

View App Logs

databricks apps logs open-navigator --follow

Update Frontend

cd frontend
# Make changes...
npm run build
cd ..
./scripts/deploy-databricks-app.sh

Run Tests

source venv/bin/activate
pytest tests/

Check Agent Status

curl http://localhost:8000/api/agents/status

πŸ“Š Frontend Pages

Page Route Description
Dashboard / Stats, charts, recent activity
Heatmap /heatmap Interactive map of opportunities
Documents /documents Browse analyzed documents
Opportunities /opportunities Manage advocacy opportunities
Settings /settings Configure system

πŸ”§ Configuration

Environment Variables

Variable Required Description
DATABRICKS_HOST Yes Workspace URL
DATABRICKS_TOKEN Yes Access token
OPENAI_API_KEY Yes OpenAI API key
DATABRICKS_WAREHOUSE_ID Yes SQL warehouse

Databricks Secrets

# Create secrets scope
databricks secrets create-scope --scope oral-health-app

# Add secrets
databricks secrets put --scope oral-health-app --key host --string-value "$DATABRICKS_HOST"
databricks secrets put --scope oral-health-app --key token --string-value "$DATABRICKS_TOKEN"
databricks secrets put --scope oral-health-app --key openai_key --string-value "$OPENAI_API_KEY"

πŸ› Troubleshooting

"Frontend not built"

cd frontend && npm install && npm run build

"Module not found"

source venv/bin/activate
pip install -r requirements-cpu.txt

"Databricks CLI not found"

pip install databricks-cli

"Can't connect to backend"

Check that backend is running on :8000 and frontend proxies to it.


πŸ“š Documentation

  • Full Deployment Guide: DATABRICKS_APP_GUIDE.md
  • Refactoring Details: REACT_REFACTORING.md
  • Agent Bricks Info: databricks/README.md
  • Main README: README.md

πŸ†˜ Need Help?

  1. Check logs: databricks apps logs open-navigator
  2. Review docs in the /docs folder
  3. Open an issue on GitHub

⚑ Pro Tips

  • Use npm run dev for instant hot reload during UI development
  • Deploy often - deployment takes ~2 minutes
  • Monitor with databricks apps get open-navigator
  • Scale to zero saves costs when idle
  • Use Chrome DevTools to debug React components

Happy Advocating! 🦷✨