- Docker Desktop installed and running
- Docker Compose v2+
- OpenAI API key
# Copy the example file
cp .env.docker .env
# Edit .env and add your OPENAI_API_KEY
nano .env # or vim, code, etc.docker-compose upOr, to run in the background:
docker-compose up -dAfter starting, you'll have access to:
- Django Admin: http://localhost:8000/admin
- Django API: http://localhost:8000/api/documents/
- Ingest Service: http://localhost:8001
- Query API: http://localhost:8002
- Qdrant Dashboard: http://localhost:6333/dashboard
docker-compose logs -fdocker-compose logs -f django
docker-compose logs -f ingest
docker-compose logs -f api
docker-compose logs -f qdrantdocker-compose downdocker-compose down -vdocker-compose build
docker-compose up# Django - create superuser
docker-compose exec django python web/manage.py createsuperuser
# Django - run migrations
docker-compose exec django python web/manage.py migrate
# Django - create migrations
docker-compose exec django python web/manage.py makemigrations
# Django - shell
docker-compose exec django python web/manage.py shell
# View Qdrant logs
docker-compose logs qdrantOn the first run, you'll need to create a superuser:
# Start services
docker-compose up -d
# Wait a few seconds for services to start
# Create superuser
docker-compose exec django python web/manage.py createsuperuser
# Follow the instructions and create your user- URL: http://localhost:8000/admin
- Login with the created superuser
- In admin, go to "Documents"
- Click "Add Document"
- Upload a PDF
- The document will be automatically processed by the Ingest Service
curl -X POST http://localhost:8002/query \
-H "Content-Type: application/json" \
-d '{
"query": "What is the main topic?",
"tenant_id": 1,
"top_k": 10,
"rerank_top_k": 5
}'Check if all services are healthy:
# Qdrant
curl http://localhost:6333/health
# Django
curl http://localhost:8000/admin/
# Ingest Service
curl http://localhost:8001/health
# Query API
curl http://localhost:8002/healthFor development with hot-reload:
# Volumes are mapped, so code changes
# are automatically reflected (hot-reload active)
docker-compose up# View logs
docker-compose logs <service-name>
# Rebuild the image
docker-compose build <service-name>
docker-compose up <service-name># Remove Django volume
docker-compose down -v
docker-compose up# Remove Qdrant volume
docker-compose down
docker volume rm contexta_qdrant_storage
docker-compose up# On Linux, you may need to adjust permissions
sudo chown -R $USER:$USER .All variables are in .env:
OPENAI_API_KEY: Your OpenAI key (required)DJANGO_SECRET_KEY: Django secret keyDEBUG: True for development, False for productionQDRANT_COLLECTION: Collection name in QdrantOPENAI_EMBEDDING_MODEL: Embedding model (text-embedding-3-large)
For production, make the following changes:
- Change
DEBUG=Falsein.env - Generate a secure new
DJANGO_SECRET_KEY - Configure production variables in
.env - Use a production server (gunicorn) instead of runserver
- Configure a PostgreSQL database
- Configure a reverse proxy web server (nginx)
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ Django │────▶│ Ingest │────▶│ Qdrant │
│ (Port 8000)│ │ (Port 8001) │ │ (Port 6333) │
└─────────────┘ └──────────────┘ └──────────────┘
│
│
┌──────▼───────┐
│ Query API │
│ (Port 8002) │
└──────────────┘
Docker Compose creates the following volumes:
qdrant_storage: Stores Qdrant datadjango_static: Django static filesdjango_media: File uploads
For backup:
docker run --rm -v contexta_qdrant_storage:/data -v $(pwd):/backup \
alpine tar czf /backup/qdrant_backup.tar.gz /dataFor convenience, you can use the Makefile:
# Start all services
make up
# Stop all services
make down
# View logs
make logs
# Rebuild and restart
make restart
# Clean everything (remove volumes)
make clean---For more detailed information, see the main README.md