# docker-compose.dev.yml - Development environment
# Used by: Manual development with `docker compose -f docker-compose.dev.yml up`
#
# This file is the SINGLE SOURCE OF TRUTH for development container configuration.
# All values use environment variable substitution from .env files.
# Named volumes persist data between container restarts.
#
# Requirements: 15.1, 16.1, 16.4, 16.5, 17.2
#
# Usage:
# Start database + ollama: docker compose -f docker-compose.dev.yml up -d
# Start with ThoughtMCP: docker compose -f docker-compose.dev.yml --profile app up -d
# Start with pgAdmin: docker compose -f docker-compose.dev.yml --profile tools up -d
# Start all: docker compose -f docker-compose.dev.yml --profile app --profile tools up -d
# Stop services: docker compose -f docker-compose.dev.yml down
# Stop and remove data: docker compose -f docker-compose.dev.yml down -v
#
# REST API Access:
# When started with --profile app, the REST API is available at:
# http://localhost:${REST_API_PORT:-3000}/api/v1/
#
# Configure CORS_ORIGINS in .env to allow your Mind Palace UI origin
services:
# PostgreSQL with pgvector extension for development
postgres:
image: pgvector/pgvector:pg16
container_name: thoughtmcp-postgres-dev
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER:-thoughtmcp_dev}
POSTGRES_PASSWORD: ${DB_PASSWORD:-dev_password}
POSTGRES_DB: ${DB_NAME:-thoughtmcp_dev}
POSTGRES_INITDB_ARGS: "-E UTF8"
ports:
- "${DB_PORT:-5432}:5432"
volumes:
# Persist database data
- postgres_dev_data:/var/lib/postgresql/data
# Initialize database with schema
- ./scripts/db/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
# Create pgvector extension
- ./scripts/db/enable-pgvector.sql:/docker-entrypoint-initdb.d/02-enable-pgvector.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-thoughtmcp_dev} -d ${DB_NAME:-thoughtmcp_dev}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- thoughtmcp-dev
# Ollama for local embedding generation
ollama:
image: ollama/ollama:latest
container_name: thoughtmcp-ollama-dev
restart: unless-stopped
ports:
- "${OLLAMA_PORT:-11434}:11434"
volumes:
# Persist downloaded models
- ollama_dev_models:/root/.ollama
healthcheck:
# Use ollama list instead of curl since curl is not available in the ollama image
test: ["CMD", "ollama", "list"]
interval: 10s
timeout: 10s
retries: 10
start_period: 15s
networks:
- thoughtmcp-dev
# ThoughtMCP development server (optional)
# Start with: docker compose -f docker-compose.dev.yml --profile app up -d
thoughtmcp:
build:
context: .
dockerfile: Dockerfile
container_name: thoughtmcp-server-dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
ollama:
condition: service_healthy
environment:
# Database configuration (uses internal Docker network)
DATABASE_URL: postgresql://${DB_USER:-thoughtmcp_dev}:${DB_PASSWORD:-dev_password}@postgres:5432/${DB_NAME:-thoughtmcp_dev}
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: ${DB_NAME:-thoughtmcp_dev}
DB_USER: ${DB_USER:-thoughtmcp_dev}
DB_PASSWORD: ${DB_PASSWORD:-dev_password}
DB_POOL_SIZE: ${DB_POOL_SIZE:-20}
# Ollama configuration (uses internal Docker network)
OLLAMA_HOST: http://ollama:11434
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-nomic-embed-text}
EMBEDDING_DIMENSION: ${EMBEDDING_DIMENSION:-768}
# Application configuration
NODE_ENV: development
LOG_LEVEL: ${LOG_LEVEL:-DEBUG}
LOG_FORMAT: ${LOG_FORMAT:-text}
# Performance configuration
CACHE_TTL: ${CACHE_TTL:-300}
MAX_PROCESSING_TIME: ${MAX_PROCESSING_TIME:-30000}
ENABLE_CACHE: ${ENABLE_CACHE:-true}
ENABLE_MONITORING: ${ENABLE_MONITORING:-true}
# Feature flags
ENABLE_BIAS_DETECTION: ${ENABLE_BIAS_DETECTION:-true}
ENABLE_EMOTION_DETECTION: ${ENABLE_EMOTION_DETECTION:-true}
ENABLE_METACOGNITION: ${ENABLE_METACOGNITION:-true}
# Standby mode - container stays alive, MCP clients connect via docker exec
MCP_STANDBY_MODE: ${MCP_STANDBY_MODE:-true}
# REST API configuration (Requirements: 16.1)
REST_API_ENABLED: ${REST_API_ENABLED:-true}
REST_API_PORT: ${REST_API_PORT:-3000}
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5173,http://localhost:3000}
# MCP servers communicate via stdio
stdin_open: true
tty: true
# Expose REST API port
ports:
- "${REST_API_PORT:-3000}:3000"
networks:
- thoughtmcp-dev
profiles:
- app
# Optional: pgAdmin for database management
# Start with: docker compose -f docker-compose.dev.yml --profile tools up -d
pgadmin:
image: dpage/pgadmin4:latest
container_name: thoughtmcp-pgadmin-dev
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@thoughtmcp.local}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- pgadmin_dev_data:/var/lib/pgadmin
depends_on:
postgres:
condition: service_healthy
networks:
- thoughtmcp-dev
profiles:
- tools
volumes:
postgres_dev_data:
driver: local
ollama_dev_models:
driver: local
pgadmin_dev_data:
driver: local
networks:
thoughtmcp-dev:
driver: bridge