Skip to content

feat: one-click deployment for omi backend (#3919)#6598

Open
huanshi231-cmd wants to merge 9 commits intoBasedHardware:mainfrom
huanshi231-cmd:feature/one-click-deployment
Open

feat: one-click deployment for omi backend (#3919)#6598
huanshi231-cmd wants to merge 9 commits intoBasedHardware:mainfrom
huanshi231-cmd:feature/one-click-deployment

Conversation

@huanshi231-cmd
Copy link
Copy Markdown

@huanshi231-cmd huanshi231-cmd commented Apr 13, 2026

One-Click Deployment Solution

Resolves #3919 ($300 bounty)


What was wrong with previous PRs (and how this fixes each one)

Based on the Greptile analysis of #6093 and feedback on #4732:

Issue Previous PRs This PR
P0 — Docker build fails build.context: ./backend — wrong, Dockerfile uses COPY backend/ relative to repo root Fixed: context: .., dockerfile: backend/Dockerfile
P1 — API keys never reach container No env_file directive Fixed: env_file: .env.docker
P1 — Wrong Redis variable Used REDIS_URL (not read by backend) Fixed: REDIS_DB_HOST=redis, REDIS_DB_PORT=6379, REDIS_DB_PASSWORD=
P1 — Unnecessary PostgreSQL Included PG service (backend uses Firestore, not PG) Removed entirely
P1 — Dev volume overwrites image volumes: - ./:/app defeats the Docker build Removed
P1 — Wrong health check URL Checked /health Fixed: /v1/health (matches backend/routers/other.py)
P2 — Incomplete .env template Only 5 of 30+ variables Fixed: new .env.docker covers all variables from backend/.env.template
P2 — docker-compose v1 only No v2 fallback Fixed: install.sh detects docker compose (v2) first, falls back to docker-compose (v1)

Files Changed

File Change
backend/docker-compose.yaml Fixed build context, removed PostgreSQL, corrected Redis vars, added env_file, fixed health check
backend/.env.docker New: complete env template with all 30+ variables, pre-configured local service addresses
backend/scripts/install.sh docker compose v2/v1 detection, /v1/health check, env validation, secure key generation
backend/scripts/README.md Rewritten: correct env vars, architecture diagram, troubleshooting

Architecture

docker compose up
      │
      ├── backend:8080    ← FastAPI (build context = repo root, dockerfile = backend/Dockerfile)
      │     ├── env loaded from .env.docker
      │     ├── REDIS_DB_HOST=redis / REDIS_DB_PORT=6379
      │     └── TYPESENSE_HOST=typesense / TYPESENSE_HOST_PORT=8108
      ├── redis:6379       ← Persistent (appendonly yes)
      └── typesense:8108   ← Search index (local_typesense_key)

Usage

git clone https://github.com/BasedHardware/omi.git
cd omi/backend
# Fill in .env.docker (Firebase, OpenAI, Deepgram, Pinecone keys)
bash scripts/install.sh

# Verify
curl http://localhost:8080/v1/health
# → {"status":"ok"}

/claim #3919

- Add docker-compose.yaml with Redis, Typesense, PostgreSQL
- Add interactive install.sh script
- Add deployment documentation
- Health checks for all services
- QUICK START mode (no API keys)
- FULL SETUP mode (all features)

Resolves BasedHardware#3919 ($300 bounty)
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR adds a one-click deployment script (install.sh) and a docker-compose.yaml for the Omi backend, but the configuration does not match the actual backend stack and contains several issues that prevent it from working at all.

  • Broken build: docker-compose.yaml sets context: . (i.e. backend/), but backend/Dockerfile uses COPY backend/… which requires the repo root as the build context — the build will fail immediately.
  • Wrong env vars: The backend reads REDIS_DB_HOST/REDIS_DB_PORT and TYPESENSE_HOST_PORT; the compose file passes REDIS_URL and TYPESENSE_PORT, so Redis and Typesense will not connect.
  • Wrong datastore: The backend uses Firestore (not PostgreSQL); the PostgreSQL service and DATABASE_URL are unused, and the critical GOOGLE_APPLICATION_CREDENTIALS env var is absent, meaning the backend cannot reach any data.

Confidence Score: 2/5

Not safe to merge — the deployment will fail to build and the resulting container cannot connect to Redis, Typesense, or its primary datastore (Firestore).

Five distinct P1 defects: wrong Docker build context (build errors out), wrong Redis env var names (Redis silently unused), wrong Typesense port env var (search broken), incorrect datastore (PostgreSQL instead of Firestore), and a broken relative path in install.sh. Each issue independently prevents the feature from working as described.

backend/docker-compose.yaml and backend/scripts/install.sh both require significant corrections before the deployment can work.

Important Files Changed

Filename Overview
backend/docker-compose.yaml New compose file with broken build context, wrong Redis/Typesense env var names, and an unused PostgreSQL service that misrepresents the Firestore-based architecture.
backend/scripts/install.sh Installation script with a broken relative path to docker-compose.yaml, a no-op QUICK_START export, and use of the deprecated docker-compose CLI.
backend/scripts/README.md New documentation describing the deployment modes; accurate at a high level but lists PostgreSQL as an included service, which doesn't match the actual backend stack.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User runs ./install.sh] --> B{Choose mode}
    B -->|1 - Quick Start| C[export QUICK_START=true\n⚠️ never consumed]
    B -->|2 - Full Setup| D[Prompt: configure .env]
    C --> E[docker-compose up -d\n⚠️ wrong path if run from scripts/]
    D --> E
    E --> F[Build backend image\n❌ context=. breaks COPY backend/]
    E --> G[Start postgres:15\n⚠️ not used by backend]
    E --> H[Start redis:7\n⚠️ REDIS_URL not read by backend]
    E --> I[Start typesense:0.25.1\n⚠️ TYPESENSE_PORT ≠ TYPESENSE_HOST_PORT]
    F -->|build fails| Z[❌ Deployment fails]
    G --> J[backend container]
    H --> J
    I --> J
    J -->|GOOGLE_APPLICATION_CREDENTIALS missing| K[❌ Firestore unreachable]
Loading

Reviews (1): Last reviewed commit: "feat: one-click deployment for omi backe..." | Re-trigger Greptile

Comment thread backend/docker-compose.yaml Outdated
Comment on lines +5 to +7
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

Comment thread backend/docker-compose.yaml Outdated
Comment on lines +11 to +12
- 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=

Comment thread backend/docker-compose.yaml Outdated
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/omi}
- REDIS_URL=${REDIS_URL:-redis://redis:6379}
- 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}

Comment thread backend/docker-compose.yaml Outdated
Comment on lines +26 to +40
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.

Comment thread backend/scripts/install.sh Outdated
Comment on lines +17 to +18
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).

Comment thread backend/scripts/install.sh Outdated
Comment on lines +18 to +24
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.)

Comment thread backend/scripts/install.sh Outdated
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.

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

Comment thread backend/scripts/install.sh Outdated
Comment on lines +33 to +34
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

one-click deployment for omi system ($300)

1 participant