Docker Deployment
This guide covers running Soliplex using Docker and Docker Compose.
Prerequisites
- Docker 20.10+ with BuildKit enabled
- Docker Compose 2.0+
- Access to an LLM provider (Ollama or OpenAI)
Dockerfile Overview
The Dockerfile uses a multi-stage build with three stages:
| Stage | Purpose |
|---|---|
base |
System packages and non-root user |
development |
Full toolchain; expects bind-mounted source code |
production |
Minimal image with only runtime dependencies |
The production stage is the last stage in the file, so it is the
default target when no --target is specified.
# Production (default)
docker build -t soliplex .
# Development
docker build -t soliplex-dev --target development .
Non-root User
Both targets run as a soliplex user rather than root. The UID and GID
default to 1000 and can be set at build time:
This is most useful on Linux hosts where bind-mounted files must match the host user's ownership. On Docker Desktop (Windows / macOS), the defaults work without adjustment.
Health Check
Both targets include a HEALTHCHECK instruction that polls the
GET /api/ok endpoint:
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/ok')"
Docker uses this to report container health and to drive restart
policies and Compose depends_on conditions.
.dockerignore
The repository includes a .dockerignore file that excludes .git,
.venv, __pycache__, .env, test suites, documentation sources, and
runtime data directories (db/, uploads/). This keeps the build
context small and prevents secrets from leaking into the image.
Docker Compose
The docker-compose.yaml defines two backend services:
soliplex_backend (production)
Builds the default production target. Configuration is mounted from the host; source code is baked into the image.
soliplex_dev (development)
Builds the development target with hot reloading and bind-mounted source code so that edits on the host take effect immediately.
On Linux, pass your UID/GID so that files written by the container are owned by your host user:
The development service:
- Bind-mounts
./src/soliplexinto the container (live code changes) - Bind-mounts
./testsfor in-container test runs - Runs with
--reload=bothso uvicorn restarts on Python or YAML config changes - Uses
--no-auth-modefor convenience
Configuration
-
Create environment file
Copy the example environment file and configure your secrets:
Edit
.envto set required variables (see Environment Variables below). -
Configure installation path
The backend expects configuration at
/app/installationinside the container. By default, the./exampledirectory is mounted there.To use a custom configuration:
-
Database persistence
The
./dbdirectory is mounted to persist: -
RAG vector database (
db/rag/) - Thread persistence database
- Room authorization database
Common Commands
# Start production backend
docker compose up soliplex_backend
# Start development backend with hot reload
docker compose up soliplex_dev
# Rebuild after dependency changes
docker compose up --build soliplex_backend
# Run in detached mode
docker compose up -d soliplex_backend
# View logs
docker compose logs -f soliplex_backend
# Stop all services
docker compose down
Accessing the Application
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Building Custom Docker Images
Build manually:
Run manually:
docker run -p 8000:8000 \
--env-file .env \
-v $(pwd)/example:/app/installation \
-v $(pwd)/db:/app/db \
soliplex-backend
Environment Variables
The backend container reads environment variables from:
.envfile (specified withenv_fileindocker-compose.yaml)- Environment variables set in
docker-compose.yaml - Shell environment (if using
docker run)
Required Variables
See .env.example for a complete list.
For Ollama:
If you run Ollama as a Docker container:
Otherwise:
For OpenAI:
Accessing Host Services
When running Ollama or other services on your host machine, use
host.docker.internal:
On Linux, you may need to add this to docker-compose.yaml (already
included):
Volume Mounts
Configuration Files (./example:/app/installation)
Mounts your configuration directory into the container. Contents:
installation.yamlorminimal.yaml-- Main installation confighaiku.rag.yaml-- RAG configurationrooms/-- Room configurationscompletions/-- Completion endpoint configurationsoidc/-- OIDC provider configurationsquizzes/-- Quiz question files
Database Files (./db:/app/db)
Persists application data:
db/rag/rag.lancedb/-- RAG vector database- SQLite databases for threads and authorization (if using defaults)
Important: Initialize the RAG database before first run (see RAG Setup below).
Source Code (./src/soliplex:/app/src/soliplex)
Only used by the soliplex_dev service. Bind-mounts your working tree
into the container so that edits are picked up by the uvicorn reloader.
Tests (./tests:/app/tests)
Only used by the soliplex_dev service. Allows running the test suite
inside the container:
RAG Database Setup in Docker
The RAG database must be initialized before starting the backend server.
Option 1: Initialize on Host (Recommended)
Initialize the database on your host machine before running Docker:
# Install haiku-rag (full version for ingestion)
uv pip install haiku-rag
# Set Ollama URL
export OLLAMA_BASE_URL=http://localhost:11434
# Initialize and populate RAG database
haiku-rag --config example/haiku.rag.yaml init --db db/rag/rag.lancedb
haiku-rag --config example/haiku.rag.yaml add-src --db db/rag/rag.lancedb docs/
The ./db directory will be mounted into the container with the
initialized database.
Option 2: Initialize in Container
Run initialization inside the backend container:
# Start container with shell
docker compose run --rm soliplex_backend /bin/bash
# Inside container
export OLLAMA_BASE_URL=http://host.docker.internal:11434
pip install haiku-rag # Install full version
haiku-rag --config /app/installation/haiku.rag.yaml init --db /app/db/rag/rag.lancedb
haiku-rag --config /app/installation/haiku.rag.yaml add-src --db /app/db/rag/rag.lancedb /app/docs/
exit
Common Issues
Port Already in Use
If port 8000 is already allocated, edit docker-compose.yaml:
Cannot Connect to Ollama
Ensure OLLAMA_BASE_URL uses host.docker.internal:
Verify Ollama is running on host:
RAG Database Not Found
The backend will fail if the RAG database hasn't been initialized.
Check for database files:
If missing, initialize as described in the RAG Database Setup section.
Permission Issues
If you encounter permission errors with mounted volumes on Linux, ensure the container user's UID matches your host user:
For existing directories:
Production Considerations
- Authentication: Never use
--no-auth-modein production - Secrets: Use Docker secrets or a secrets manager rather than
.envfiles - Database: Consider PostgreSQL instead of SQLite for production
- Reverse Proxy: Place behind nginx or traefik with HTTPS
- Resource Limits: Set memory and CPU limits via Compose
deploy - Capabilities: Replace
privileged: truewith the narrowest capability set that supports bubblewrap (e.g.,cap_add: [SYS_ADMIN]) and test thoroughly
Next Steps
- Configure OIDC authentication: OIDC Providers
- Set up rooms: Room Configuration
- Configure agents: Agent Configuration
- Review server documentation: Server Setup