services:
# Development Kafka Cluster (Primary)
kafka-dev:
image: confluentinc/cp-kafka:7.5.0
hostname: kafka-dev
container_name: kafka-dev
ports:
- "9092:9092" # Standard Kafka port for single-registry compatibility
- "9094:9094" # Controller port
- "39092:39092" # Alternative port for multi-registry
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka-dev:9094
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092,PLAINTEXT_ALT://0.0.0.0:39092,CONTROLLER://0.0.0.0:9094
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_ALT:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-dev:9092,PLAINTEXT_ALT://localhost:39092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_LOG_DIRS: /tmp/kraft-combined-logs
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
CLUSTER_ID: "MkVlNjdqWVF0Q056MWFrUA"
KAFKA_INITIAL_BROKER_REGISTRATION_TIMEOUT_MS: 60000
command: >
bash -c "
echo 'Starting Kafka DEV cluster...' &&
/etc/confluent/docker/run"
healthcheck:
test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9092", "--list"]
interval: 10s
timeout: 10s
retries: 10
start_period: 30s
networks:
- kafka-test-network
# Production Kafka Cluster (Secondary for multi-registry tests)
kafka-prod:
image: confluentinc/cp-kafka:7.5.0
hostname: kafka-prod
container_name: kafka-prod
ports:
- "39093:9093" # Production Kafka port
- "39095:9095" # Production Controller port
environment:
KAFKA_NODE_ID: 2
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: 2@kafka-prod:9095
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9093,CONTROLLER://0.0.0.0:9095
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-prod:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_LOG_DIRS: /tmp/kraft-combined-logs
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
CLUSTER_ID: "bDN3SjhUaFNLYzhsOFJHOA"
KAFKA_INITIAL_BROKER_REGISTRATION_TIMEOUT_MS: 60000
command: >
bash -c "
echo 'Starting Kafka PROD cluster...' &&
/etc/confluent/docker/run"
healthcheck:
test: ["CMD", "kafka-topics", "--bootstrap-server", "localhost:9093", "--list"]
interval: 10s
timeout: 10s
retries: 10
start_period: 30s
networks:
- kafka-test-network
# Development Schema Registry (Primary - compatible with single-registry tests)
schema-registry-dev:
image: confluentinc/cp-schema-registry:7.5.0
hostname: schema-registry-dev
container_name: schema-registry-dev
depends_on:
kafka-dev:
condition: service_healthy
ports:
- "38081:8081" # Standard port used by all existing tests
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry-dev
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka-dev:9092
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
SCHEMA_REGISTRY_DELETE_SUBJECT_ENABLED: "true"
SCHEMA_REGISTRY_DELETE_VERSION_ENABLED: "true"
SCHEMA_REGISTRY_SCHEMA_COMPATIBILITY_LEVEL: "backward"
SCHEMA_REGISTRY_LOG4J_ROOT_LOGLEVEL: "INFO"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/subjects"]
interval: 10s
timeout: 5s
retries: 15
start_period: 45s
networks:
- kafka-test-network
# Production Schema Registry (Secondary for multi-registry tests)
schema-registry-prod:
image: confluentinc/cp-schema-registry:7.5.0
hostname: schema-registry-prod
container_name: schema-registry-prod
depends_on:
kafka-prod:
condition: service_healthy
ports:
- "38082:8082" # Production registry port
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry-prod
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka-prod:9093
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8082
SCHEMA_REGISTRY_DELETE_SUBJECT_ENABLED: "true"
SCHEMA_REGISTRY_DELETE_VERSION_ENABLED: "true"
SCHEMA_REGISTRY_SCHEMA_COMPATIBILITY_LEVEL: "forward"
SCHEMA_REGISTRY_LOG4J_ROOT_LOGLEVEL: "INFO"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8082/subjects"]
interval: 10s
timeout: 5s
retries: 15
start_period: 45s
networks:
- kafka-test-network
# MCP Server for testing MCP protocol integration
mcp-server:
build:
context: ..
dockerfile: Dockerfile
image: kafka-schema-registry-mcp:test
container_name: mcp-server
depends_on:
schema-registry-dev:
condition: service_healthy
schema-registry-prod:
condition: service_healthy
environment:
# Single registry mode (default for backward compatibility)
- SCHEMA_REGISTRY_URL=http://schema-registry-dev:8081
# Multi-registry mode configuration
- SCHEMA_REGISTRY_1_NAME=dev
- SCHEMA_REGISTRY_1_URL=http://schema-registry-dev:8081
- SCHEMA_REGISTRY_2_NAME=prod
- SCHEMA_REGISTRY_2_URL=http://schema-registry-prod:8082
# MCP configuration
- MCP_SERVER_NAME=kafka-schema-registry
- MCP_SERVER_VERSION=1.0.0
- PYTHONUNBUFFERED=1
# Allow localhost URLs for testing
- ALLOW_LOCALHOST=true
networks:
- kafka-test-network
# Keep container running for MCP stdio communication
stdin_open: true
tty: true
# Override CMD to keep container running for testing
command: >
bash -c "
echo 'MCP Server container started. Ready for stdio communication.' &&
echo 'To test: docker exec -i mcp-server python kafka_schema_registry_unified_mcp.py' &&
tail -f /dev/null"
healthcheck:
test: ["CMD", "python", "-c", "import kafka_schema_registry_unified_mcp; print('healthy')"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# AKHQ UI for monitoring and management
akhq:
image: tchiotludo/akhq:0.25.1
container_name: akhq-ui
depends_on:
schema-registry-dev:
condition: service_healthy
schema-registry-prod:
condition: service_healthy
ports:
- "38080:8080"
environment:
AKHQ_CONFIGURATION: |
akhq:
connections:
development:
properties:
bootstrap.servers: "kafka-dev:9092"
schema-registry:
url: "http://schema-registry-dev:8081"
connect:
- name: "dev-connect"
url: "http://kafka-dev:8083"
production:
properties:
bootstrap.servers: "kafka-prod:9093"
schema-registry:
url: "http://schema-registry-prod:8082"
connect:
- name: "prod-connect"
url: "http://kafka-prod:8084"
ui-options:
topic:
default-view: ALL
topic-data:
sort: OLDEST
pagination:
page-size: 25
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
interval: 15s
timeout: 10s
retries: 10
start_period: 60s
networks:
- kafka-test-network
networks:
kafka-test-network:
name: kafka-test-network
driver: bridge
ipam:
driver: default
config:
- subnet: 172.20.0.0/16
volumes:
kafka-dev-data:
name: kafka-dev-data
kafka-prod-data:
name: kafka-prod-data