Docker Quickstart¶
Django RAGKit provides full Docker Compose support with pre-configured PostgreSQL (pgvector), an official pre-built container image, and an automated one-line installer.
Quick Install (Automated Installer)¶
The fastest and easiest way to install and run Django RAGKit on Linux or macOS is using the official one-line interactive installer script.
1. Run the Installer¶
Run the following command in your terminal:
The installer script (install.sh) automates the entire deployment process end-to-end:
- Creates Installation Directory: Creates a dedicated project directory at
/opt/django-ragkit. - Downloads Configurations: Automatically downloads the latest
compose.yml,.env.docker, and.env.exampledirectly from GitHub. - Interactive Configuration Wizard: Prompts you for your environment settings with sensible defaults:
- PostgreSQL database name, user, and password
- Django
DEBUGmode toggle - Allowed hosts (with
localhostand127.0.0.1included automatically) - Embedding provider API key
- LLM provider API key
- Automatic Secret Key Generation: Generates a cryptographically secure 50-character
DJANGO_SECRET_KEYusing Python'ssecretsmodule and writes all values to.env. - Starts Docker Containers: Executes
docker compose up -dusing the official pre-built image and PostgreSQL withpgvector. - Applies Database Migrations: Automatically runs
docker compose exec -T ragkit python manage.py migrateto apply all migrations and activate the vector database extension. - Creates Admin Superuser (Optional): Prompts you to optionally create a Django superuser interactively.
- Ready to Use: Makes Django RAGKit immediately accessible at
http://localhost:8000.
2. Configuring Django & RAGKit (settings.py via .env)¶
When running Django RAGKit in Docker, you do not need to modify settings.py directly inside the container. All application and pipeline configurations in settings.py are mapped to environment variables and managed entirely through the .env file located at /opt/django-ragkit/.env.
To configure or update your settings, open the file using nano:
Available Configuration Variables¶
Here are the primary variables and how they map to Django and the RAGKIT dictionary in settings.py:
| Variable | Maps to settings.py |
Default / Description |
|---|---|---|
DJANGO_SECRET_KEY |
SECRET_KEY |
Cryptographic secret key for Django sessions and security |
DEBUG |
DEBUG |
True for development, False for production |
DJANGO_ALLOWED_HOSTS |
ALLOWED_HOSTS |
Comma-separated list of allowed domains/IPs (e.g. localhost,127.0.0.1) |
POSTGRES_DB |
DATABASES['default']['NAME'] |
PostgreSQL database name (e.g. dockerdjango) |
POSTGRES_USER |
DATABASES['default']['USER'] |
PostgreSQL database user (e.g. dbuser) |
POSTGRES_PASSWORD |
DATABASES['default']['PASSWORD'] |
PostgreSQL database password |
RAGKIT_LOGIN_REQUIRED |
RAGKIT['BASE_SETTING']['LOGIN_REQUIRED'] |
Set True to require user login for chat access |
RAGKIT_EMBEDDING_PROVIDER |
RAGKIT['EMBEDDING']['PROVIDER'] |
Embedding provider (openrouter or ollama) |
RAGKIT_EMBEDDING_MODEL |
RAGKIT['EMBEDDING']['MODEL'] |
Embedding model (e.g. baai/bge-m3 or nomic-embed-text) |
RAGKIT_EMBEDDING_BASE_URL |
RAGKIT['EMBEDDING']['BASE_URL'] |
API endpoint (e.g. https://openrouter.ai/api/v1) |
RAGKIT_EMBEDDING_DIMENSION |
RAGKIT['EMBEDDING']['DIMENSION'] |
Vector dimension size (e.g. 1024 or 768, max: 2000) |
RAGKIT_EMBEDDING_API_KEY |
RAGKIT['EMBEDDING']['API_KEY'] |
API key for embedding provider |
RAGKIT_LLM_PROVIDER |
RAGKIT['LLM']['PROVIDER'] |
LLM provider (openrouter or ollama) |
RAGKIT_LLM_MODEL |
RAGKIT['LLM']['MODEL'] |
LLM model name (e.g. nex-agi/nex-n2.5-mini:free) |
RAGKIT_LLM_BASE_URL |
RAGKIT['LLM']['BASE_URL'] |
LLM endpoint URL |
RAGKIT_LLM_API_KEY |
RAGKIT['LLM']['API_KEY'] |
API key for LLM provider |
RAGKIT_LLM_BASE_PROMPT |
RAGKIT['LLM']['OPTIONS']['BASE_PROMPT'] |
(Optional) Custom system prompt for RAG answers |
RAGKIT_LLM_NOT_FOUND_PROMPT |
RAGKIT['LLM']['OPTIONS']['NOT_FOUND_PROMPT'] |
(Optional) Fallback message when no matching context exists |
3. Applying Changes¶
Whenever you modify /opt/django-ragkit/.env, restart the Docker containers to apply the new configuration:
[!IMPORTANT] Changing Vector Dimensions (
RAGKIT_EMBEDDING_DIMENSION != 1024): The default PostgreSQL database schema is pre-configured for 1024 dimensions (matching models likebaai/bge-m3).If you set a different dimension in
.env(such as768for Ollama'snomic-embed-textor1536for OpenAI models), PostgreSQL column constraints require updating the embeddings table schema.You must run the
This command will:reset_embeddingscommand inside the running Docker container:
- Safely archive your existing embeddings table into a backup table (zero data loss).
- Rebuild the vector table with your new dimension and recreate the HNSW vector index.
- Automatically synchronize Django migrations.
For full technical details and recovery options, see the Reset Embeddings Command guide.
[!TIP] Manual Docker Compose & Advanced Setup: If you prefer deploying manually with Docker Compose, running custom images, connecting to local Ollama, or managing container lifecycles, see the comprehensive Docker Image & Manual Setup guide.