diff --git a/.env.example b/.env.example index 6f1d1da..c83f1ee 100644 --- a/.env.example +++ b/.env.example @@ -191,7 +191,7 @@ SURREAL_URL="ws://surrealdb/rpc:8000" SURREAL_USER="root" SURREAL_PASSWORD="root" SURREAL_NAMESPACE="open_notebook" -SURREAL_DATABASE="staging" +SURREAL_DATABASE="open_notebook" # RETRY CONFIGURATION (surreal-commands v1.2.0+) # Global defaults for all background commands unless explicitly overridden at command level diff --git a/README.md b/README.md index 6d849cb..3748743 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ docker run -d \ -e SURREAL_USER="root" \ -e SURREAL_PASSWORD="root" \ -e SURREAL_NAMESPACE="open_notebook" \ - -e SURREAL_DATABASE="production" \ + -e SURREAL_DATABASE="open_notebook" \ lfnovo/open_notebook:v1-latest-single ``` @@ -150,7 +150,7 @@ docker run -d \ -e SURREAL_USER="root" \ -e SURREAL_PASSWORD="root" \ -e SURREAL_NAMESPACE="open_notebook" \ - -e SURREAL_DATABASE="production" \ + -e SURREAL_DATABASE="open_notebook" \ lfnovo/open_notebook:v1-latest-single ``` @@ -194,7 +194,7 @@ services: - SURREAL_USER=root - SURREAL_PASSWORD=root - SURREAL_NAMESPACE=open_notebook - - SURREAL_DATABASE=production + - SURREAL_DATABASE=open_notebook volumes: - ./notebook_data:/app/data - ./surreal_data:/mydata diff --git a/docs/0-START-HERE/quick-start-cloud.md b/docs/0-START-HERE/quick-start-cloud.md index 282d8e6..1d04899 100644 --- a/docs/0-START-HERE/quick-start-cloud.md +++ b/docs/0-START-HERE/quick-start-cloud.md @@ -58,7 +58,7 @@ services: - SURREAL_USER=root - SURREAL_PASSWORD=password - SURREAL_NAMESPACE=open_notebook - - SURREAL_DATABASE=production + - SURREAL_DATABASE=open_notebook volumes: - ./notebook_data:/app/data depends_on: diff --git a/docs/0-START-HERE/quick-start-local.md b/docs/0-START-HERE/quick-start-local.md index 5385c72..ef0f355 100644 --- a/docs/0-START-HERE/quick-start-local.md +++ b/docs/0-START-HERE/quick-start-local.md @@ -49,7 +49,7 @@ services: - SURREAL_USER=root - SURREAL_PASSWORD=password - SURREAL_NAMESPACE=open_notebook - - SURREAL_DATABASE=production + - SURREAL_DATABASE=open_notebook volumes: - ./notebook_data:/app/data - ./surreal_data:/mydata diff --git a/docs/0-START-HERE/quick-start-openai.md b/docs/0-START-HERE/quick-start-openai.md index 8ab834c..a65fae1 100644 --- a/docs/0-START-HERE/quick-start-openai.md +++ b/docs/0-START-HERE/quick-start-openai.md @@ -41,7 +41,7 @@ services: - SURREAL_USER=root - SURREAL_PASSWORD=password - SURREAL_NAMESPACE=open_notebook - - SURREAL_DATABASE=production + - SURREAL_DATABASE=open_notebook volumes: - ./notebook_data:/app/data depends_on: diff --git a/docs/1-INSTALLATION/docker-compose.md b/docs/1-INSTALLATION/docker-compose.md index d68fe5e..8cc4e95 100644 --- a/docs/1-INSTALLATION/docker-compose.md +++ b/docs/1-INSTALLATION/docker-compose.md @@ -58,7 +58,7 @@ services: - SURREAL_USER=root - SURREAL_PASSWORD=password - SURREAL_NAMESPACE=open_notebook - - SURREAL_DATABASE=production + - SURREAL_DATABASE=open_notebook volumes: - ./notebook_data:/app/data depends_on: diff --git a/docs/1-INSTALLATION/single-container.md b/docs/1-INSTALLATION/single-container.md index aefca97..2321414 100644 --- a/docs/1-INSTALLATION/single-container.md +++ b/docs/1-INSTALLATION/single-container.md @@ -32,7 +32,7 @@ services: - SURREAL_USER=root - SURREAL_PASSWORD=password - SURREAL_NAMESPACE=open_notebook - - SURREAL_DATABASE=production + - SURREAL_DATABASE=open_notebook volumes: - ./data:/app/data restart: always diff --git a/docs/5-CONFIGURATION/database.md b/docs/5-CONFIGURATION/database.md index 21df0f2..c726ca1 100644 --- a/docs/5-CONFIGURATION/database.md +++ b/docs/5-CONFIGURATION/database.md @@ -1,429 +1,50 @@ # Database - SurrealDB Configuration -Open Notebook uses SurrealDB for data storage. This guide covers configuration (usually not needed). +Open Notebook uses SurrealDB for its database needs. --- ## Default Configuration -In most deployments, SurrealDB is pre-configured. These settings work: +Open Notebook should work out of the box with SurrealDB as long as the environment variables are correctly setup. + + +### DB running in the same docker compose as Open Notebook (recommended) + +The example above is for when you are running SurrealDB as a separate docker container, which is the method described [here](../1-INSTALLATION/docker-compose.md) (and our recommended method). ```env SURREAL_URL="ws://surrealdb:8000/rpc" SURREAL_USER="root" SURREAL_PASSWORD="root" SURREAL_NAMESPACE="open_notebook" -SURREAL_DATABASE="staging" +SURREAL_DATABASE="open_notebook" ``` -**If this is already configured, you can skip this page.** +### DB running in the host machine and Open Notebook running in Docker ---- - -## When to Change Configuration - -You only need to change database configuration if: - -1. **Using a remote SurrealDB** (not in Docker) -2. **Multiple databases** (dev/staging/production) -3. **Custom authentication** (not default credentials) -4. **Running your own SurrealDB** instance -5. **Advanced networking** (Kubernetes, proxies) - ---- - -## Understanding the Settings - -### SURREAL_URL - -The connection URL for SurrealDB. +If ON is running in docker and SurrealDB is on your host machine, you need to point to it. ```env -# WebSocket protocol (recommended) -SURREAL_URL="ws://surrealdb:8000/rpc" - -# HTTP protocol (alternative) -SURREAL_URL="http://surrealdb:8000" - -# For remote instance -SURREAL_URL="ws://db.example.com:8000/rpc" - -# With HTTPS -SURREAL_URL="wss://db.example.com:8000/rpc" -``` - -**Format:** -- Protocol: `ws://` (WebSocket) or `http://` (HTTP) or `wss://`, `https://` -- Host: `surrealdb` (Docker service name) or IP/domain -- Port: `8000` (default) -- Path: `/rpc` (for WebSocket) - -**Docker to Docker:** Use service name -``` -SURREAL_URL="ws://surrealdb:8000/rpc" ✓ Correct -``` - -**Outside to Docker:** Use IP/domain -``` -SURREAL_URL="ws://192.168.1.100:8000/rpc" ✓ Correct -``` - ---- - -### SURREAL_USER & SURREAL_PASSWORD - -Authentication credentials. - -```env -SURREAL_USER="root" -SURREAL_PASSWORD="root" -``` - -**In production, change these!** - -```env -SURREAL_USER="your_username" -SURREAL_PASSWORD="your_secure_password" -``` - -**Requirements:** -- Username: Any non-empty string -- Password: Any non-empty string -- No special characters recommended (can cause parsing issues) - ---- - -### SURREAL_NAMESPACE - -Logical grouping for multiple applications. - -```env -SURREAL_NAMESPACE="open_notebook" -``` - -You can have multiple namespaces in one SurrealDB instance: -``` -open_notebook -open_notebook_dev -open_notebook_test -``` - -**Typical setup:** -- Development: `open_notebook_dev` -- Staging: `open_notebook_staging` -- Production: `open_notebook_prod` - ---- - -### SURREAL_DATABASE - -Database within the namespace. - -```env -SURREAL_DATABASE="staging" -``` - -Typical options: -``` -staging (development/testing) -production (production data) -test (automated tests) -backup (archived data) -``` - -**Note:** Different databases in same namespace are completely separate. - ---- - -## Setup Scenarios - -### Scenario 1: Default Docker Setup (Most Common) - -```env -# docker.env -SURREAL_URL="ws://surrealdb:8000/rpc" +SURREAL_URL="ws://your-machine-ip:8000/rpc" #or host.docker.internal SURREAL_USER="root" SURREAL_PASSWORD="root" SURREAL_NAMESPACE="open_notebook" -SURREAL_DATABASE="staging" +SURREAL_DATABASE="open_notebook" ``` -Used by the default docker-compose configuration. **No changes needed.** +### Open Notebook and Surreal are running on the same machine ---- +If you are running both services locally or if you are using the deprecated [single container setup](../1-INSTALLATION/single-container.md) -### Scenario 2: Production with Custom Credentials - -```env -# docker.env -SURREAL_URL="ws://surrealdb:8000/rpc" -SURREAL_USER="surrealdb_user" -SURREAL_PASSWORD="$(openssl rand -base64 32)" # Generate secure password -SURREAL_NAMESPACE="open_notebook" -SURREAL_DATABASE="production" -``` - -Also configure SurrealDB with the same credentials: -```bash -docker run -e SURREAL_USER=surrealdb_user \ - -e SURREAL_PASSWORD=your_secure_password \ - surrealdb/surrealdb:v2 -``` - ---- - -### Scenario 3: Remote SurrealDB Instance - -```env -# .env -SURREAL_URL="ws://db.example.com:8000/rpc" -SURREAL_USER="your_username" -SURREAL_PASSWORD="your_password" -SURREAL_NAMESPACE="open_notebook" -SURREAL_DATABASE="staging" -``` - -Make sure: -- SurrealDB is running on remote server -- Port 8000 is accessible from your network -- Credentials match what you set on remote instance - ---- - -### Scenario 4: Separate Databases for Dev/Test/Prod - -```env -# dev .env -SURREAL_DATABASE="staging" - -# prod .env -SURREAL_DATABASE="production" - -# test .env -SURREAL_DATABASE="test" -``` - -All use same SurrealDB instance but different databases (completely isolated data). - ---- - -## Running Your Own SurrealDB - -If you need a separate SurrealDB instance: - -### Option 1: Docker Container - -```bash -docker run \ - --name surrealdb \ - -p 8000:8000 \ - -e SURREAL_USER=root \ - -e SURREAL_PASSWORD=root \ - surrealdb/surrealdb:v2 \ - start --bind 0.0.0.0:8000 --log trace --strict -``` - -Then configure Open Notebook: ```env SURREAL_URL="ws://localhost:8000/rpc" SURREAL_USER="root" SURREAL_PASSWORD="root" +SURREAL_NAMESPACE="open_notebook" +SURREAL_DATABASE="open_notebook" ``` -### Option 2: Install Locally +## Multiple databases -```bash -# Download from https://surrealdb.com/install -# Extract and run: -surreal start --bind 0.0.0.0:8000 -``` - -Then configure: -```env -SURREAL_URL="ws://localhost:8000/rpc" -``` - ---- - -## Persistence and Storage - -### In-Memory (Not Recommended) - -```bash -# Data is lost on restart -surreal start --bind 0.0.0.0:8000 memory -``` - -### On-Disk (Recommended) - -```bash -# Data persists -surreal start --bind 0.0.0.0:8000 file:./surreal.db -``` - -If using Docker Compose, the default includes volume mapping: - -```yaml -services: - surrealdb: - image: surrealdb/surrealdb:v2 - volumes: - - surreal_data:/data # Data persists here - command: start --bind 0.0.0.0:8000 file:/data/surreal.db -``` - ---- - -## Connection Testing - -### Verify Connection - -```bash -# Using curl to test WebSocket connection -curl -i -N -H "Connection: Upgrade" \ - -H "Upgrade: websocket" \ - http://localhost:8000/rpc -``` - -### Check in Open Notebook - -``` -1. Start services -2. Go to Open Notebook -3. Try creating a notebook -4. If it works, database is connected -``` - -### Check API Logs - -```bash -# For Docker -docker compose logs api | grep -i "surreal" - -# Look for connection messages -``` - ---- - -## Troubleshooting - -### "Cannot connect to database" - -**Cause:** Connection URL is wrong or SurrealDB not running - -**Fix:** -```bash -# Verify SurrealDB is running -docker ps | grep surrealdb - -# Check connection URL is correct -# Try accessing directly: ws://localhost:8000 (use WebSocket client) -``` - -### "Authentication failed" - -**Cause:** Username/password incorrect - -**Fix:** -1. Check SURREAL_USER and SURREAL_PASSWORD in .env -2. Verify SurrealDB was started with same credentials -3. Credentials are case-sensitive - -### "Timeout connecting to database" - -**Cause:** Network/firewall issue - -**Fix:** -1. Verify port 8000 is accessible -2. Check firewall rules -3. Use correct hostname/IP (not localhost if connecting from different container) - -### "Connection lost during operation" - -**Cause:** Network intermittent, SurrealDB restarting, or timeout - -**Check** environment variable: -```env -# Increase retry configuration -SURREAL_COMMANDS_RETRY_MAX_ATTEMPTS=5 -SURREAL_COMMANDS_RETRY_WAIT_MAX=60 -``` - ---- - -## Retry Configuration - -For reliability with transient failures: - -```env -# Enable retries (default: true) -SURREAL_COMMANDS_RETRY_ENABLED=true - -# Maximum retry attempts (default: 3) -SURREAL_COMMANDS_RETRY_MAX_ATTEMPTS=3 - -# Wait strategy between retries (default: exponential_jitter) -SURREAL_COMMANDS_RETRY_WAIT_STRATEGY=exponential_jitter - -# Minimum wait (seconds, default: 1) -SURREAL_COMMANDS_RETRY_WAIT_MIN=1 - -# Maximum wait (seconds, default: 30) -SURREAL_COMMANDS_RETRY_WAIT_MAX=30 -``` - -**Strategies:** -- `exponential_jitter` — Recommended (prevents thundering herd) -- `exponential` — Good for rate limiting -- `fixed` — Predictable retry timing -- `random` — Unpredictable timing - ---- - -## Concurrency - -Control how many concurrent database operations: - -```env -# Maximum concurrent tasks (default: 5) -SURREAL_COMMANDS_MAX_TASKS=5 -``` - -**Guidance:** -- Low-resource system: 1-2 -- Normal system: 5 (recommended) -- High-resource system: 10-20 - -Higher concurrency increases speed but also increases database conflicts (retries handle this). - ---- - -## Advanced: Kubernetes / Custom Networking - -If using Kubernetes or complex networking: - -```env -# Kubernetes example -SURREAL_URL="ws://surrealdb-service.default.svc.cluster.local:8000/rpc" -SURREAL_USER="your-user" -SURREAL_PASSWORD="your-password" -``` - -**Key points:** -- Use service DNS name, not IP -- Port must be exposed in service definition -- Credentials must match SurrealDB deployment - ---- - -## Summary - -**Default setup works for 99% of cases.** - -Only change if: -1. Using separate/remote SurrealDB -2. Multiple databases (dev/prod separation) -3. Custom networking -4. Advanced deployment scenarios - -If you're using the default docker-compose setup, **don't change anything on this page.** +You can have multiple namespaces in one SurrealDB instance and you can also have multiple databases in one instance. So, if you want to setup multiple open noteobok deployments for different users, you don't need to deploy multiple databases. diff --git a/docs/5-CONFIGURATION/environment-reference.md b/docs/5-CONFIGURATION/environment-reference.md index 5374e25..b3cfeb8 100644 --- a/docs/5-CONFIGURATION/environment-reference.md +++ b/docs/5-CONFIGURATION/environment-reference.md @@ -176,7 +176,7 @@ For self-hosted LLMs, LM Studio, or OpenAI-compatible endpoints: | `SURREAL_USER` | Yes | root | SurrealDB username | | `SURREAL_PASSWORD` | Yes | root | SurrealDB password | | `SURREAL_NAMESPACE` | Yes | open_notebook | SurrealDB namespace | -| `SURREAL_DATABASE` | Yes | staging | SurrealDB database name | +| `SURREAL_DATABASE` | Yes | open_notebook | SurrealDB database name | --- diff --git a/docs/5-CONFIGURATION/index.md b/docs/5-CONFIGURATION/index.md index 3865aa0..0bc8193 100644 --- a/docs/5-CONFIGURATION/index.md +++ b/docs/5-CONFIGURATION/index.md @@ -88,7 +88,7 @@ SURREAL_URL=ws://surrealdb:8000/rpc SURREAL_USER=root SURREAL_PASSWORD=root # Change in production! SURREAL_NAMESPACE=open_notebook -SURREAL_DATABASE=staging # or "production" +SURREAL_DATABASE=open_notebook ``` Usually pre-configured. Only change if using different database. diff --git a/new_docs/0-START-HERE/quick-start-local.md b/new_docs/0-START-HERE/quick-start-local.md new file mode 100644 index 0000000..8b8c901 --- /dev/null +++ b/new_docs/0-START-HERE/quick-start-local.md @@ -0,0 +1,260 @@ +# Quick Start - Local & Private (5 minutes) + +Get Open Notebook running with **100% local AI** using Ollama. No cloud API keys needed, completely private. + +## Prerequisites + +1. **Docker Desktop** installed + - [Download here](https://www.docker.com/products/docker-desktop/) + - Already have it? Skip to step 2 + +2. **Ollama** installed (for local LLM) + - [Download here](https://ollama.ai/) + - Or use Docker image (easier): `ollama/ollama` + +## Step 1: Choose Your Setup (1 min) + +### 🏠 Local Machine (Same Computer) +Everything runs on your machine. Recommended for testing/learning. + +### 🌐 Remote Server (Raspberry Pi, NAS, Cloud VM) +Run on a different computer, access from another. Needs network configuration. + +--- + +## Step 2: Create Configuration (1 min) + +Create a new folder `open-notebook-local` and add this file: + +**docker-compose.yml**: +```yaml +services: + surrealdb: + image: surrealdb/surrealdb:v2 + command: start --user root --pass password --bind 0.0.0.0:8000 memory + ports: + - "8000:8000" + + open_notebook: + image: lfnovo/open_notebook:v1-latest-single + ports: + - "8502:8502" # Web UI (React frontend) + - "5055:5055" # API (required!) + environment: + # NO API KEYS NEEDED - Using Ollama (free, local) + - OLLAMA_API_BASE=http://ollama:11434 + + # Database (required) + - SURREAL_URL=ws://surrealdb:8000/rpc + - SURREAL_USER=root + - SURREAL_PASSWORD=password + - SURREAL_NAMESPACE=open_notebook + - SURREAL_DATABASE=open_notebook + volumes: + - ./notebook_data:/app/data + - ./surreal_data:/mydata + depends_on: + - surrealdb + restart: always + + ollama: + image: ollama/ollama:latest + ports: + - "11434:11434" + volumes: + - ./ollama_models:/root/.ollama + environment: + # Optional: set GPU support if available + - OLLAMA_NUM_GPU=0 + restart: always +``` + +**That's it!** No API keys, no secrets, completely private. + +--- + +## Step 3: Start Services (1 min) + +Open terminal in your `open-notebook-local` folder: + +```bash +docker compose up -d +``` + +Wait 10-15 seconds for all services to start. + +--- + +## Step 4: Download a Model (2-3 min) + +Ollama needs at least one language model. Pick one: + +```bash +# Fastest & smallest (recommended for testing) +docker exec open_notebook-ollama-1 ollama pull mistral + +# OR: Better quality but slower +docker exec open_notebook-ollama-1 ollama pull neural-chat + +# OR: Even better quality, more VRAM needed +docker exec open_notebook-ollama-1 ollama pull llama2 +``` + +This downloads the model (will take 1-5 minutes depending on your internet). + +--- + +## Step 5: Access Open Notebook (instant) + +Open your browser: +``` +http://localhost:8502 +``` + +You should see the Open Notebook interface. + +--- + +## Step 6: Configure Local Model (1 min) + +1. Click **Settings** (top right) → **Models** +2. Set: + - **Language Model**: `ollama/mistral` (or whichever model you downloaded) + - **Embedding Model**: `ollama/nomic-embed-text` (auto-downloads if missing) +3. Click **Save** + +--- + +## Step 7: Create Your First Notebook (1 min) + +1. Click **New Notebook** +2. Name: "My Private Research" +3. Click **Create** + +--- + +## Step 8: Add Local Content (1 min) + +1. Click **Add Source** +2. Choose **Text** +3. Paste some text or a local document +4. Click **Add** + +--- + +## Step 9: Chat With Your Content (1 min) + +1. Go to **Chat** +2. Type: "What did you learn from this?" +3. Click **Send** +4. Watch as the local Ollama model responds! + +--- + +## Verification Checklist + +- [ ] Docker is running +- [ ] You can access `http://localhost:8502` +- [ ] Models are configured +- [ ] You created a notebook +- [ ] Chat works with local model + +**All checked?** 🎉 You have a completely **private, offline** research assistant! + +--- + +## Advantages of Local Setup + +✅ **No API costs** - Free forever +✅ **No internet required** - True offline capability +✅ **Privacy first** - Your data never leaves your machine +✅ **No subscriptions** - No monthly bills + +**Trade-off:** Slower than cloud models (depends on your CPU/GPU) + +--- + +## Troubleshooting + +### "ollama: command not found" + +Docker image name might be different: +```bash +docker ps # Find the Ollama container name +docker exec ollama pull mistral +``` + +### Model Download Stuck + +Check internet connection and restart: +```bash +docker compose restart ollama +``` + +Then retry the model pull command. + +### "Address already in use" Error + +```bash +docker compose down +docker compose up -d +``` + +### Low Performance + +Check if GPU is available: +```bash +# Show available GPUs +docker exec open_notebook-ollama-1 ollama ps + +# Enable GPU in docker-compose.yml: +# - OLLAMA_NUM_GPU=1 +``` + +Then restart: `docker compose restart ollama` + +### Adding More Models + +```bash +# List available models +docker exec open_notebook-ollama-1 ollama list + +# Pull additional model +docker exec open_notebook-ollama-1 ollama pull neural-chat +``` + +--- + +## Next Steps + +**Now that it's running:** + +1. **Add Your Own Content**: PDFs, documents, articles (see 3-USER-GUIDE) +2. **Explore Features**: Podcasts, transformations, search +3. **Full Documentation**: [See all features](../3-USER-GUIDE/index.md) +4. **Scale Up**: Deploy to a server with better hardware for faster responses +5. **Benchmark Models**: Try different models to find the speed/quality tradeoff you prefer + +--- + +## Going Further + +- **Switch models**: Change in Settings → Models anytime +- **Add more models**: Run `ollama pull ` and they'll appear in Settings +- **Deploy to server**: Same docker-compose.yml works anywhere +- **Use cloud hybrid**: Keep some local models, add OpenAI/Anthropic for complex tasks + +--- + +## Common Model Choices + +| Model | Speed | Quality | VRAM | Best For | +|-------|-------|---------|------|----------| +| **mistral** | Fast | Good | 4GB | Testing, general use | +| **neural-chat** | Medium | Better | 6GB | Balanced, recommended | +| **llama2** | Slow | Best | 8GB+ | Complex reasoning | +| **phi** | Very Fast | Fair | 2GB | Minimal hardware | + +--- + +**Need Help?** Join our [Discord community](https://discord.gg/37XJPXfz2w) - many users run local setups! diff --git a/new_docs/1-INSTALLATION/docker-compose.md b/new_docs/1-INSTALLATION/docker-compose.md new file mode 100644 index 0000000..630b7c9 --- /dev/null +++ b/new_docs/1-INSTALLATION/docker-compose.md @@ -0,0 +1,324 @@ +# Docker Compose Installation (Recommended) + +Multi-container setup with separate services. **Best for most users.** + +## Prerequisites + +- **Docker Desktop** installed ([Download](https://www.docker.com/products/docker-desktop/)) +- **5-10 minutes** of your time +- **API key** for at least one AI provider (OpenAI recommended for beginners) + +## Step 1: Get an API Key (2 min) + +Choose at least one AI provider. **OpenAI or OpenRouter recommended if you're unsure:** + +``` +OpenAI: https://platform.openai.com/api-keys +Anthropic: https://console.anthropic.com/ +Google: https://aistudio.google.com/ +Groq: https://console.groq.com/ +``` + +Add at least $5 in credits to your account. + +(Skip this if using Ollama for free local models) + +--- + +## Step 2: Create Configuration (2 min) + +Create a folder `open-notebook` and add this file: + +**docker-compose.yml**: +```yaml +services: + surrealdb: + image: surrealdb/surrealdb:v2 + command: start --user root --pass password --bind 0.0.0.0:8000 memory + ports: + - "8000:8000" + volumes: + - surreal_data:/mydata + + api: + image: lfnovo/open_notebook:v1-latest + ports: + - "5055:5055" + environment: + # AI Provider (choose ONE) + - OPENAI_API_KEY=sk-... # Your OpenAI key + # - ANTHROPIC_API_KEY=sk-ant-... # Or Anthropic + # - GOOGLE_API_KEY=... # Or Google + + # Database + - SURREAL_URL=ws://surrealdb:8000/rpc + - SURREAL_USER=root + - SURREAL_PASSWORD=password + - SURREAL_NAMESPACE=open_notebook + - SURREAL_DATABASE=open_notebook + + # API Configuration + - API_URL=http://localhost:5055 + depends_on: + - surrealdb + volumes: + - ./data:/app/data + restart: always + + frontend: + image: lfnovo/open_notebook-frontend:v1-latest + ports: + - "3000:3000" + environment: + - NEXT_PUBLIC_API_URL=http://localhost:5055 + depends_on: + - api + restart: always + +volumes: + surreal_data: +``` + +**Edit the file:** +- Replace `sk-...` with your actual OpenAI API key +- (Or use Anthropic, Google, Groq keys instead) +- If you have multiple keys, uncomment the ones you want + +--- + +## Step 3: Start Services (2 min) + +Open terminal in the `open-notebook` folder: + +```bash +docker compose up -d +``` + +Wait 15-20 seconds for all services to start: +``` +✅ surrealdb running on :8000 +✅ api running on :5055 +✅ frontend running on :3000 +``` + +Check status: +```bash +docker compose ps +``` + +--- + +## Step 4: Verify Installation (1 min) + +**API Health:** +```bash +curl http://localhost:5055/health +# Should return: {"status": "healthy"} +``` + +**Frontend Access:** +Open browser to: +``` +http://localhost:3000 +``` + +You should see the Open Notebook interface! + +--- + +## Step 5: First Notebook (2 min) + +1. Click **New Notebook** +2. Name: "My Research" +3. Description: "Getting started" +4. Click **Create** + +Done! You now have a fully working Open Notebook instance. 🎉 + +--- + +## Configuration + +### Using Different AI Providers + +Change `environment` section in `docker-compose.yml`: + +```yaml +# For Anthropic (Claude) +- ANTHROPIC_API_KEY=sk-ant-... + +# For Google Gemini +- GOOGLE_API_KEY=... + +# For Groq (fast, free tier available) +- GROQ_API_KEY=... + +# For local Ollama (free, offline) +- OLLAMA_BASE_URL=http://ollama:11434 +``` + +### Adding Ollama (Free Local Models) + +Add to `docker-compose.yml`: + +```yaml + ollama: + image: ollama/ollama:latest + ports: + - "11434:11434" + volumes: + - ollama_models:/root/.ollama + restart: always + +volumes: + surreal_data: + ollama_models: +``` + +Then update API service: +```yaml +environment: + - OLLAMA_BASE_URL=http://ollama:11434 +``` + +Restart and pull a model: +```bash +docker compose restart +docker exec open_notebook-ollama-1 ollama pull mistral +``` + +--- + +## Environment Variables Reference + +| Variable | Purpose | Example | +|----------|---------|---------| +| `OPENAI_API_KEY` | OpenAI API key | `sk-proj-...` | +| `ANTHROPIC_API_KEY` | Anthropic/Claude key | `sk-ant-...` | +| `SURREAL_URL` | Database connection | `ws://surrealdb:8000/rpc` | +| `SURREAL_USER` | Database user | `root` | +| `SURREAL_PASSWORD` | Database password | `password` | +| `SURREAL_NAMESPACE` | The namespace | `open_notebook` | +| `SURREAL_DATABASE` | The database to use | `open_notebook` | +| `API_URL` | API external URL | `http://localhost:5055` | +| `NEXT_PUBLIC_API_URL` | Frontend API URL | `http://localhost:5055` | + +--- + +## Common Tasks + +### Stop Services +```bash +docker compose down +``` + +### View Logs +```bash +# All services +docker compose logs -f + +# Specific service +docker compose logs -f api +``` + +### Restart Services +```bash +docker compose restart +``` + +### Update to Latest Version +```bash +docker compose down +docker compose pull +docker compose up -d +``` + +### Remove All Data +```bash +docker compose down -v +``` + +--- + +## Troubleshooting + +### "Cannot connect to API" Error + +1. Check if Docker is running: +```bash +docker ps +``` + +2. Check if services are running: +```bash +docker compose ps +``` + +3. Check API logs: +```bash +docker compose logs api +``` + +4. Wait longer - services can take 20-30 seconds to start on first run + +--- + +### Port Already in Use + +If you get "Port 3000 already in use", change the port: + +```yaml +ports: + - "3001:3000" # Use 3001 instead +``` + +Then access at `http://localhost:3001` + +--- + +### API Key Not Working + +1. Double-check your API key in the file (no extra spaces) +2. Verify key is valid at provider's website +3. Check you added credits to your account +4. Restart: `docker compose restart api` + +--- + +### Database Connection Issues + +Check SurrealDB is running: +```bash +docker compose logs surrealdb +``` + +Reset database: +```bash +docker compose down -v +docker compose up -d +``` + +--- + +## Next Steps + +1. **Add Content**: Sources, notebooks, documents +2. **Configure Models**: Settings → Models (choose your preferences) +3. **Explore Features**: Chat, search, transformations +4. **Read Guide**: [User Guide](../3-USER-GUIDE/index.md) + +--- + +## Production Deployment + +For production use, see: +- [Security Hardening](https://github.com/lfnovo/open-notebook/blob/main/docs/deployment/security.md) +- [Reverse Proxy](https://github.com/lfnovo/open-notebook/blob/main/docs/deployment/reverse-proxy.md) + +--- + +## Getting Help + +- **Discord**: [Community support](https://discord.gg/37XJPXfz2w) +- **Issues**: [GitHub Issues](https://github.com/lfnovo/open-notebook/issues) +- **Docs**: [Full documentation](../index.md) diff --git a/setup_guide/docker.env b/setup_guide/docker.env index b7962da..63f3e0e 100644 --- a/setup_guide/docker.env +++ b/setup_guide/docker.env @@ -9,5 +9,5 @@ SURREAL_URL="ws://localhost/rpc:8000" SURREAL_USER="root" SURREAL_PASSWORD="root" SURREAL_NAMESPACE="open_notebook" -SURREAL_DATABASE="staging" +SURREAL_DATABASE="open_notebook"