Installation
MedCATtrainer is packaged as a Docker Compose deployment with three core services:
medcattrainer(Django API + background workers)nginx(serves UI and proxies API)solr(concept search index for concept lookup)
Prerequisites
Docker Engine
Docker Compose v2 (
docker composecommand)
Quick start (prebuilt images)
git clone https://github.com/CogStack/cogstack-nlp
cd cogstack-nlp/medcat-trainer
docker compose up -d
Open the app at http://localhost:8001 (unless you changed MCTRAINER_PORT).
Useful logs:
docker compose logs -f medcattrainer
docker compose logs -f nginx
docker compose logs -f solr
Build from source (development)
docker compose -f docker-compose-dev.yml up --build
This uses the local webapp/ source tree and is the recommended setup for
development work.
Legacy MedCAT v0.x support
If you still need the legacy MedCAT v0.x-compatible stack:
docker compose -f docker-compose-mc0x.yml up -d
Environment configuration
Runtime settings are mainly defined in:
envs/env(non-prod defaults)envs/env-prod(production-oriented defaults)
Host-level Compose variables (for example port overrides) can be set by copying
.env-example to .env and editing values.
Common environment variables
Variable |
Description |
|---|---|
|
Host port for the web UI/API (default |
|
Host port for Solr admin (default |
|
MedCAT config file path inside the container. |
|
Load example model pack + dataset + project on startup ( |
|
Timeout (seconds) for remote model-service calls. |
|
Bootstrap admin username (default |
|
Bootstrap admin email. |
|
Bootstrap admin password (change in real deployments). |
SMTP (optional, for password reset emails)
Set:
EMAIL_USEREMAIL_PASSEMAIL_HOSTEMAIL_PORT
If SMTP is not configured, password reset workflows will fail.
OIDC (Keycloak) authentication (optional)
Set USE_OIDC=1 and provide:
Variable |
Description |
|---|---|
|
Public Keycloak URL (frontend redirect/login). |
|
Keycloak realm name. |
|
URL to redirect users to on logout. |
|
Backend-reachable Keycloak URL. |
|
Public frontend client ID. |
|
Confidential backend client ID. |
|
Backend client secret. |
Optional token refresh tuning:
KEYCLOAK_TOKEN_MIN_VALIDITY(default30)KEYCLOAK_TOKEN_REFRESH_INTERVAL(default20)
Role mapping:
medcattrainer_superuser-> Django superuser/staffmedcattrainer_staff-> Django staff
PostgreSQL support (optional)
SQLite is default. For larger deployments, set:
Variable |
Description |
|---|---|
|
|
|
Database name |
|
Database user |
|
Database password |
|
Database host/service |
|
Database port (default |
An example compose file is available at
docker-compose-example-postgres.yml.
Troubleshooting
Exit code 137 during build/start: container memory is too low. Increase Docker memory allocation.
Cannot log in with default admin: verify bootstrap admin env vars and startup logs.
Concept picker empty: confirm Solr is running and concepts were imported for the selected CDB.