Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions backend/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Wrong build context — Docker build will fail

The existing backend/Dockerfile was written to be built from the repository root: it uses COPY backend/requirements.txt and COPY backend/ ., which require the context to include a backend/ subdirectory. Setting context: . when docker-compose.yaml lives inside backend/ makes the context backend/, so Docker will look for backend/backend/requirements.txt — which doesn't exist and causes the build to fail immediately.

Fix: set the context to the repo root.

Suggested change
build:
context: .
dockerfile: Dockerfile
build:
context: ..
dockerfile: backend/Dockerfile

ports:
- "8080:8080"
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/omi}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Env vars don't match what the backend reads

Two mismatches here that will silently break the services:

  1. DATABASE_URL — the backend uses Firestore as its primary database, not PostgreSQL. There is no DATABASE_URL read anywhere in the backend code; the PostgreSQL service (and this env var) have no effect and only add confusion.

  2. REDIS_URLbackend/database/redis_db.py reads os.getenv('REDIS_DB_HOST') (plus REDIS_DB_PORT and REDIS_DB_PASSWORD) as separate env vars, not a connection URL. Passing REDIS_URL means Redis will not be connected and the backend silently falls back to no-cache / no-rate-limiting mode.

Replace with the variables the backend actually consumes:

Suggested change
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/omi}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- REDIS_DB_HOST=redis
- REDIS_DB_PORT=6379
- REDIS_DB_PASSWORD=

- TYPESENSE_HOST=${TYPESENSE_HOST:-typesense}
- TYPESENSE_PORT=${TYPESENSE_PORT:-8108}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Typesense port env var name mismatch

backend/utils/conversations/search.py reads os.getenv('TYPESENSE_HOST_PORT'), but this compose file exposes the variable as TYPESENSE_PORT. The search client will receive None for the port and the Typesense connection will fail.

Suggested change
- TYPESENSE_PORT=${TYPESENSE_PORT:-8108}
- TYPESENSE_HOST_PORT=${TYPESENSE_HOST_PORT:-8108}

- TYPESENSE_API_KEY=${TYPESENSE_API_KEY:-xyz}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
typesense:
condition: service_healthy
volumes:
- ./:/app

postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: omi
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 PostgreSQL service is unused — the backend runs on Firestore

The backend's primary datastore is Firestore (Google Cloud), not PostgreSQL. The backend/CLAUDE.md and backend/.env.template confirm there is no DATABASE_URL or any Postgres driver in the stack. Shipping a PostgreSQL container that nothing connects to misleads contributors and wastes resources.

The actual credentials the backend needs to start are GOOGLE_APPLICATION_CREDENTIALS (Firestore / GCS) and OPENAI_API_KEY (required for LLM calls). Neither is present in the compose file, so even the "QUICK START" mode won't produce a working backend.


redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5

typesense:
image: typesense/typesense:0.25.1
ports:
- "8108:8108"
environment:
- TYPESENSE_API_KEY=xyz
- TYPESENSE_DATA_DIR=/data
volumes:
- typesense_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8108/health"]
interval: 5s
timeout: 5s
retries: 5

volumes:
postgres_data:
redis_data:
typesense_data:
35 changes: 35 additions & 0 deletions backend/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Omi Backend One-Click Deployment

## Quick Start

```bash
./install.sh
```

## Deployment Modes

### QUICK START
- Minimal configuration
- No API keys required
- Perfect for testing and development

### FULL SETUP
- All features enabled
- Requires API key configuration
- Production-ready deployment

## Requirements

- Docker
- Docker Compose

## Services Included

- **Backend**: Main Omi API server
- **PostgreSQL**: Database
- **Redis**: Cache and message queue
- **Typesense**: Search engine

## Health Checks

All services include health checks to ensure proper startup order.
50 changes: 50 additions & 0 deletions backend/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
set -e

echo "==================================="
echo "Omi Backend One-Click Deployment"
echo "==================================="
echo ""
echo "Select deployment mode:"
echo "1) QUICK START - Minimal setup, no API keys needed"
echo "2) FULL SETUP - All features enabled"
echo ""
read -p "Enter choice [1 or 2]: " choice

if [ "$choice" = "1" ]; then
echo ""
echo "Starting QUICK START mode..."
export QUICK_START=true
docker-compose -f docker-compose.yaml up -d
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 QUICK_START is exported but never consumed

export QUICK_START=true has no effect: docker-compose.yaml does not reference QUICK_START in any env block or condition, and both branches of the if/elif run the exact same docker-compose … up -d command. The two modes are functionally identical.

Either wire QUICK_START into the compose file (e.g., to skip optional services or set reduced resource limits), or remove the export and distinguish the modes in a meaningful way (e.g., mode 1 skips a .env validity check, mode 2 validates required API keys before starting).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 docker-compose CLI is deprecated

docker-compose (v1, standalone Python binary) has been deprecated since Docker Desktop 4.x; the current command is docker compose (v2, built-in plugin). Users on newer Docker installs may not have docker-compose at all and will get a "command not found" error.

Suggested change
docker-compose -f docker-compose.yaml up -d
docker compose -f docker-compose.yaml up -d

elif [ "$choice" = "2" ]; then
echo ""
echo "Starting FULL SETUP mode..."
echo "Please ensure you have configured your API keys in .env file"
read -p "Press Enter to continue..."
docker-compose -f docker-compose.yaml up -d
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Relative path to docker-compose.yaml will fail when running from backend/scripts/

The README instructs users to run ./install.sh from backend/scripts/, but docker-compose -f docker-compose.yaml looks for docker-compose.yaml in the current working directory, which would be backend/scripts/ — not backend/. The file won't be found and the script errors out immediately.

Use the script's own directory to build an absolute path:

Suggested change
docker-compose -f docker-compose.yaml up -d
elif [ "$choice" = "2" ]; then
echo ""
echo "Starting FULL SETUP mode..."
echo "Please ensure you have configured your API keys in .env file"
read -p "Press Enter to continue..."
docker-compose -f docker-compose.yaml up -d
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
docker-compose -f "$SCRIPT_DIR/../docker-compose.yaml" up -d

(Apply the same fix to the elif branch on line 24.)

else
echo "Invalid choice. Exiting."
exit 1
fi

echo ""
echo "==================================="
echo "Waiting for services to be ready..."
echo "==================================="
sleep 10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Fixed sleep 10 instead of polling actual health

The compose file already configures health checks with condition: service_healthy on depends_on, so by the time up -d returns the services are likely not yet healthy. A hard sleep 10 either undershoots (services still starting) or wastes time. Consider polling with docker compose wait or checking health directly:

Suggested change
echo "==================================="
sleep 10
echo "Waiting for services to be ready..."
docker compose -f "$SCRIPT_DIR/../docker-compose.yaml" wait backend || true


echo ""
echo "Checking service health..."
docker-compose ps

echo ""
echo "==================================="
echo "Omi backend is now running!"
echo "==================================="
echo "Backend: http://localhost:8080"
echo "PostgreSQL: localhost:5432"
echo "Redis: localhost:6379"
echo "Typesense: localhost:8108"
echo ""
echo "To view logs: docker-compose logs -f"
echo "To stop: docker-compose down"