Files
AIclinicalresearch/redcap-docker-dev/docker-compose.yml
HaHafeng 40c2f8e148 feat(rag): Complete RAG engine implementation with pgvector
Major Features:
- Created ekb_schema (13th schema) with 3 tables: KB/Document/Chunk
- Implemented EmbeddingService (text-embedding-v4, 1024-dim vectors)
- Implemented ChunkService (smart Markdown chunking)
- Implemented VectorSearchService (multi-query + hybrid search)
- Implemented RerankService (qwen3-rerank)
- Integrated DeepSeek V3 QueryRewriter for cross-language search
- Python service: Added pymupdf4llm for PDF-to-Markdown conversion
- PKB: Dual-mode adapter (pgvector/dify/hybrid)

Architecture:
- Brain-Hand Model: Business layer (DeepSeek) + Engine layer (pgvector)
- Cross-language support: Chinese query matches English documents
- Small Embedding (1024) + Strong Reranker strategy

Performance:
- End-to-end latency: 2.5s
- Cost per query: 0.0025 RMB
- Accuracy improvement: +20.5% (cross-language)

Tests:
- test-embedding-service.ts: Vector embedding verified
- test-rag-e2e.ts: Full pipeline tested
- test-rerank.ts: Rerank quality validated
- test-query-rewrite.ts: Cross-language search verified
- test-pdf-ingest.ts: Real PDF document tested (Dongen 2003.pdf)

Documentation:
- Added 05-RAG-Engine-User-Guide.md
- Added 02-Document-Processing-User-Guide.md
- Updated system status documentation

Status: Production ready
2026-01-21 20:24:29 +08:00

155 lines
3.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# REDCap Docker Compose 配置 - 开发环境
# 版本v1.0
# 日期2026-01-01
# 用途本地开发环境包含phpMyAdmin调试工具
# 生产环境请使用docker-compose.prod.yml
version: '3.8'
services:
# ========== MySQL 8.0 数据库 ==========
redcap-db:
image: mysql:8.0
container_name: redcap-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
# 数据持久化Docker命名卷
- redcap-db-data:/var/lib/mysql
ports:
# 暴露端口(可选,调试用)
- "3306:3306"
networks:
- redcap-network
command: --default-authentication-plugin=mysql_native_password
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
# ========== REDCap Web服务 (Apache + PHP 8.1 + REDCap) ==========
redcap-web:
build:
context: .
dockerfile: Dockerfile.redcap
container_name: redcap-apache
restart: unless-stopped
ports:
- "8080:80"
volumes:
# REDCap源代码只读
- ../redcap15.8.0/redcap:/var/www/html/redcap:ro
# 配置文件
- ./config/apache/redcap.conf:/etc/apache2/sites-available/000-default.conf:ro
- ./config/php/php.ini:/usr/local/etc/php/php.ini:ro
- ./config/database.php:/var/www/html/redcap/database.php:ro
# 持久化数据(可读写)
- redcap-edocs:/var/www/html/redcap/edocs
- redcap-modules:/var/www/html/redcap/modules
- redcap-temp:/var/www/html/redcap/temp
environment:
# 数据库连接信息
REDCAP_DB_HOST: redcap-db
REDCAP_DB_PORT: 3306
REDCAP_DB_NAME: ${MYSQL_DATABASE}
REDCAP_DB_USER: ${MYSQL_USER}
REDCAP_DB_PASS: ${MYSQL_PASSWORD}
# PHP配置
TZ: Asia/Shanghai
networks:
- redcap-network
depends_on:
redcap-db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
# ========== phpMyAdmin (可选,仅开发环境) ==========
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: redcap-phpmyadmin
restart: unless-stopped
environment:
PMA_HOST: redcap-db
PMA_PORT: 3306
PMA_USER: root
PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD}
UPLOAD_LIMIT: 50M
ports:
- "8081:80"
networks:
- redcap-network
depends_on:
- redcap-db
# 注意:生产环境应移除此服务(安全考虑)
# ========== 网络配置 ==========
networks:
redcap-network:
driver: bridge
name: redcap-network
# ========== 数据卷配置 ==========
volumes:
# MySQL数据持久化
redcap-db-data:
name: redcap-db-data
driver: local
# REDCap上传文件持久化
redcap-edocs:
name: redcap-edocs
driver: local
# External Modules持久化
redcap-modules:
name: redcap-modules
driver: local
# 临时文件(可定期清理)
redcap-temp:
name: redcap-temp
driver: local