chopchat.io

docs / self-hosting

Scaling for studios

Move the self-host stack from SQLite to Postgres + Redis, and run more than one chat instance.

Scaling for studios

The default self-host stack runs the chat on its internal SQLite database — right for a single user or a small studio. When you need several instances, shared logins at scale, WebSocket coordination and guaranteed token revocation, switch to the scaled variant: a studio Compose profile, already in the same compose file, that adds Postgres and Redis.

Enable the studio profile

  1. Copy the studio env file and set a strong password:

    cp .env.studio.example .env.studio
    # set POSTGRES_PASSWORD and the same password inside DATABASE_URL
    
  2. Start with the profile:

    docker compose --profile studio up -d
    

This starts postgres and a Redis-compatible valkey alongside the base services. The chat reads DATABASE_URL, REDIS_URL and WEBSOCKET_MANAGER from .env.studio; the file is optional — absent, the chat stays on SQLite with no Redis.

REDIS_URL alone is not enough for more than one instance. The studio env file also sets WEBSOCKET_MANAGER=redis (with ENABLE_WEBSOCKET_SUPPORT=true) to coordinate WebSocket streams across instances; without it a second instance drops WebSocket streams and logins flap between instances.

SQLite → Postgres is one-way

The chat migrates its schema to Postgres automatically on first start with DATABASE_URL set, but it does not migrate your existing SQLite data.

  • Fresh install (no chats/users yet): nothing to do — just enable the profile.
  • Existing install with real users/chats: migrate before people depend on it, using a community SQLite→Postgres export/import script, or start fresh on Postgres and keep the old owui_data volume as a read-only archive.

Do it before users accumulate — it is a one-way switch.

Run more than one instance

With Postgres + Redis in place:

  • keep UVICORN_WORKERS=1 per container and run more containers behind a load balancer (replicas of the same container also work),
  • set ENABLE_DB_MIGRATIONS=false on every replica but one,
  • keep WEBUI_SECRET_KEY identical across replicas, and the same for OAUTH_SESSION_TOKEN_ENCRYPTION_KEY if you enable OAuth.

The knowledge sync agent needs no changes: it writes to the same local Qdrant, so every instance sees the same knowledge.

Shared uploads

On a single host the owui_data volume is shared by all replicas. Across hosts it is not: put data/ on shared storage (RWX), or set STORAGE_PROVIDER=s3 with an S3-compatible bucket so every replica reads the same uploads and generated files.

Keep the vector store on Qdrant

Do not move the chat's vector store to pgvector for scaling. The knowledge stack (the sync agent, the retrieval filter and the gateway) reads the local Qdrant directly, so switching VECTOR_DB away from qdrant breaks community retrieval. Qdrant is also what makes multi-instance safe here — the chat's default ChromaDB is a local SQLite store that is not safe for multiple workers.

Postgres tuning

Under load you may need a bigger connection pool. Each chat process keeps its own, so the effective ceiling is (DATABASE_POOL_SIZE + DATABASE_POOL_MAX_OVERFLOW) × replicas × workers:

DATABASE_POOL_SIZE=15          # default 5
DATABASE_POOL_MAX_OVERFLOW=20  # default 10

Keep that total well below Postgres max_connections (the bundled image defaults to 100). DATABASE_ENABLE_SESSION_SHARING=true also helps at high concurrency.

Exposing the chat

The compose binds the chat to loopback only. To serve it publicly, put a TLS-terminating reverse proxy in front and set WEBUI_URL=https://your.domain in .env.studio so links are generated correctly. Do not expose Qdrant — the sync agent handles knowledge updates.

The chat stays at http://localhost:3100 on the host.