Skip to main content

Overview

The recommended way to deploy MCRIT is using the fully packaged docker-mcrit solution. This approach ensures you have fully compatible versions across all components, including:
  • MCRIT server and worker processes
  • MongoDB database for persistence
  • Web frontend for convenient interaction
  • Proper networking between components
Docker deployment is the easiest way to get started with MCRIT and is recommended for most users.

Prerequisites

  • Docker Engine (20.10 or later)
  • Docker Compose (1.29 or later)
  • At least 4GB of available RAM
  • Sufficient disk space for MongoDB storage

Quick Start

1

Clone the docker-mcrit repository

git clone https://github.com/danielplohmann/docker-mcrit.git
cd docker-mcrit
2

Start the services

docker-compose up -d
This will start all required services in the background:
  • MCRIT Server (API)
  • MCRIT Worker (Job processing)
  • MongoDB (Data storage)
  • MCRIT Web (Frontend interface)
3

Verify the deployment

Access the web interface at http://localhost:8080 or check the API status:
curl http://localhost:8000/status

Docker Compose Configuration

The docker-compose.yml file orchestrates all MCRIT components. Here’s a typical configuration structure:
version: '3.8'

services:
  mongodb:
    image: mongo:5.0
    volumes:
      - mongodb_data:/data/db
    ports:
      - "27017:27017"
    
  mcrit-server:
    image: danielplohmann/mcrit:latest
    command: mcrit server
    ports:
      - "8000:8000"
    depends_on:
      - mongodb
    environment:
      - STORAGE_SERVER=mongodb
      - STORAGE_PORT=27017
      
  mcrit-worker:
    image: danielplohmann/mcrit:latest
    command: mcrit worker
    depends_on:
      - mongodb
      - mcrit-server
    environment:
      - QUEUE_SERVER=mongodb
      - QUEUE_PORT=27017

volumes:
  mongodb_data:

Environment Variables

MCRIT components can be configured using environment variables. The most common ones are:

Server Configuration

VariableDescriptionDefault
STORAGE_SERVERMongoDB hostname127.0.0.1
STORAGE_PORTMongoDB port27017
STORAGE_MONGODB_DBNAMEDatabase namemcrit
STORAGE_MONGODB_USERNAMEMongoDB usernameNone
STORAGE_MONGODB_PASSWORDMongoDB passwordNone
AUTH_TOKENAPI authentication token"" (disabled)

Worker Configuration

VariableDescriptionDefault
QUEUE_SERVERMongoDB hostname127.0.0.1
QUEUE_PORTMongoDB port27017
QUEUE_MONGODB_DBNAMEDatabase namemcrit
QUEUE_MONGODB_USERNAMEMongoDB usernameNone
QUEUE_MONGODB_PASSWORDMongoDB passwordNone
QUEUE_TIMEOUTJob timeout in seconds300
See the Configuration page for a complete list of available configuration options.

Port Mappings

The default port mappings for MCRIT services are:
ServiceInternal PortExternal PortDescription
MCRIT Server80008000REST API endpoint
MongoDB2701727017Database (can be hidden)
MCRIT Web30008080Web frontend
In production deployments, consider not exposing MongoDB port 27017 externally. Only the MCRIT server and worker containers need access to it.

Volume Mounts for Persistence

To ensure data persistence across container restarts, mount volumes for:

MongoDB Data

services:
  mongodb:
    volumes:
      - /var/lib/mcrit/mongodb:/data/db

Configuration Files

You can mount custom configuration files:
services:
  mcrit-server:
    volumes:
      - ./custom_config.py:/app/mcrit/config/McritConfig.py:ro

Uploaded Files and Results

services:
  mcrit-server:
    volumes:
      - /var/lib/mcrit/uploads:/app/uploads
      - /var/lib/mcrit/results:/app/results

Managing the Deployment

View Logs

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f mcrit-server
docker-compose logs -f mcrit-worker

Stop Services

docker-compose down

Stop and Remove Data

docker-compose down -v
The -v flag will delete all volumes, including your MongoDB data. Use with caution!

Update to Latest Version

docker-compose pull
docker-compose up -d

Scaling Workers

For better performance with large workloads, scale the number of workers:
docker-compose up -d --scale mcrit-worker=4
Or define multiple workers in your docker-compose.yml:
services:
  mcrit-worker-1:
    image: danielplohmann/mcrit:latest
    command: mcrit worker
    # ... configuration ...
    
  mcrit-worker-2:
    image: danielplohmann/mcrit:latest
    command: mcrit worker
    # ... configuration ...

Resource Limits

Set resource limits to prevent containers from consuming all system resources:
services:
  mcrit-worker:
    image: danielplohmann/mcrit:latest
    command: mcrit worker
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 4G
        reservations:
          cpus: '1.0'
          memory: 2G

Health Checks

Add health checks to ensure services are running properly:
services:
  mcrit-server:
    image: danielplohmann/mcrit:latest
    command: mcrit server
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/status"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s

Troubleshooting

Check if the server container is running:
docker-compose ps
View server logs:
docker-compose logs mcrit-server
Verify MongoDB connectivity from the server container:
docker-compose exec mcrit-server ping mongodb
Ensure the worker can connect to MongoDB:
docker-compose logs mcrit-worker
Check for jobs in the queue by accessing the API:
curl http://localhost:8000/jobs
Verify MongoDB is running:
docker-compose ps mongodb
Check MongoDB logs:
docker-compose logs mongodb
Ensure correct credentials in environment variables if authentication is enabled.

Next Steps

Build docs developers (and LLMs) love