From af620806e0db7a57057b9c576eeb556b47484f98 Mon Sep 17 00:00:00 2001 From: begoniezhao Date: Tue, 18 Nov 2025 17:30:26 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=96=B0=E5=A2=9E=20Docker=20Compose?= =?UTF-8?q?=20=E5=90=AF=E5=8A=A8=E9=85=8D=E7=BD=AE=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=20docker-compose.yml=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 89 ++----------------------------- README.md | 45 +++++++++++++--- README_CN.md | 45 +++++++++++++--- README_JA.md | 45 +++++++++++++--- docker-compose.yml | 127 ++++++++++++++++++++++----------------------- 5 files changed, 184 insertions(+), 167 deletions(-) diff --git a/.env.example b/.env.example index 6b035ee..e6c239e 100644 --- a/.env.example +++ b/.env.example @@ -23,10 +23,6 @@ STORAGE_TYPE=local # 流处理后端(memory/redis) STREAM_MANAGER_TYPE=redis -# 主数据库配置 -# 数据库端口,默认为5432 -DB_PORT=5432 - # 应用服务端口,默认为8080 APP_PORT=8080 @@ -46,9 +42,6 @@ DB_PASSWORD=postgres123!@# DB_NAME=WeKnora # 如果使用 redis 作为流处理后端,需要配置以下参数 -# Redis端口,默认为6379 -REDIS_PORT=6379 - # Redis密码,如果没有设置密码,可以留空 REDIS_PASSWORD=redis123!@# @@ -66,9 +59,11 @@ TENANT_AES_KEY=weknorarag-api-key-secret-secret # 是否开启知识图谱构建和检索(构建阶段需调用大模型,耗时较长) ENABLE_GRAPH_RAG=false -MINIO_PORT=9000 +# MinIO端口 +# MINIO_PORT=9000 -MINIO_CONSOLE_PORT=9001 +# MinIO控制台端口 +# MINIO_CONSOLE_PORT=9001 # Embedding并发数,出现429错误时,可调小此参数 CONCURRENCY_POOL_SIZE=5 @@ -132,79 +127,3 @@ COS_ENABLE_OLD_DOMAIN=true # Neo4j的密码 # NEO4J_PASSWORD=password - -############################################################## - -###### 注意: 以下配置不再生效,已在Web“配置初始化”阶段完成 ######### - - -# # 初始化默认租户与知识库 -# # 租户ID,通常是一个字符串 -# INIT_TEST_TENANT_ID=1 - -# # 知识库ID,通常是一个字符串 -# INIT_TEST_KNOWLEDGE_BASE_ID=kb-00000001 - -# # LLM Model -# # 使用的LLM模型名称 -# # 默认使用 Ollama 的 Qwen3 8B 模型,ollama 会自动处理模型下载和加载 -# # 如果需要使用其他模型,请替换为实际的模型名称 -# INIT_LLM_MODEL_NAME=qwen3:8b - -# # LLM模型的访问地址 -# # 支持第三方模型服务的URL -# # 如果使用 Ollama 的本地服务,可以留空,ollama 会自动处理 -# # INIT_LLM_MODEL_BASE_URL=your_llm_model_base_url - -# # LLM模型的API密钥,如果需要身份验证,可以设置 -# # 支持第三方模型服务的API密钥 -# # 如果使用 Ollama 的本地服务,可以留空,ollama 会自动处理 -# # INIT_LLM_MODEL_API_KEY=your_llm_model_api_key - -# # Embedding Model -# # 使用的Embedding模型名称 -# # 默认使用 nomic-embed-text 模型,支持文本嵌入 -# # 如果需要使用其他模型,请替换为实际的模型名称 -# INIT_EMBEDDING_MODEL_NAME=nomic-embed-text - -# # Embedding模型向量维度 -# INIT_EMBEDDING_MODEL_DIMENSION=768 - -# # Embedding模型的ID,通常是一个字符串 -# INIT_EMBEDDING_MODEL_ID=builtin:nomic-embed-text:768 - -# # Embedding模型的访问地址 -# # 支持第三方模型服务的URL -# # 如果使用 Ollama 的本地服务,可以留空,ollama 会自动处理 -# # INIT_EMBEDDING_MODEL_BASE_URL=your_embedding_model_base_url - -# # Embedding模型的API密钥,如果需要身份验证,可以设置 -# # 支持第三方模型服务的API密钥 -# # 如果使用 Ollama 的本地服务,可以留空,ollama 会自动处理 -# # INIT_EMBEDDING_MODEL_API_KEY=your_embedding_model_api_key - -# # Rerank Model(可选) -# # 对于rag来说,使用Rerank模型对提升文档搜索的准确度有着重要作用 -# # 目前 ollama 暂不支持运行 Rerank 模型 -# # 使用的Rerank模型名称 -# # INIT_RERANK_MODEL_NAME=your_rerank_model_name - -# # Rerank模型的访问地址 -# # 支持第三方模型服务的URL -# # INIT_RERANK_MODEL_BASE_URL=your_rerank_model_base_url - -# # Rerank模型的API密钥,如果需要身份验证,可以设置 -# # 支持第三方模型服务的API密钥 -# # INIT_RERANK_MODEL_API_KEY=your_rerank_model_api_key - -# # VLM_MODEL_NAME 使用的多模态模型名称 -# # 用于解析图片数据 -# # VLM_MODEL_NAME=your_vlm_model_name - -# # VLM_MODEL_BASE_URL 使用的多模态模型访问地址 -# # 支持第三方模型服务的URL -# # VLM_MODEL_BASE_URL=your_vlm_model_base_url - -# # VLM_MODEL_API_KEY 使用的多模态模型API密钥 -# # 支持第三方模型服务的API密钥 -# # VLM_MODEL_API_KEY=your_vlm_model_api_key \ No newline at end of file diff --git a/README.md b/README.md index 70e5311..ac48b18 100644 --- a/README.md +++ b/README.md @@ -119,25 +119,58 @@ cp .env.example .env # All variables are documented in the .env.example comments ``` -#### ③ Start the services +#### ③ Start the services (include Ollama) + +Check the images that need to be started in the .env file. ```bash -# Start all services (Ollama + backend containers) ./scripts/start_all.sh -# Or +``` + +or + +```bash make start-all ``` -#### ③ Start the services (backup) +#### ③.0 Start ollama services (Optional) ```bash -# Start ollama services (Optional) ollama serve > /dev/null 2>&1 & +``` -# Start the service +#### ③.1 Activate different combinations of features + +- Minimum core services +```bash docker compose up -d ``` +- All features enabled +```bash +docker-compose --profile full up -d +``` + +- Tracing logs required +```bash +docker-compose --profile jaeger up -d +``` + +- Neo4j knowledge graph required +```bash +docker-compose --profile neo4j up -d +``` + +- Minio file storage service required +```bash +docker-compose --profile minio up -d +``` + +- Multiple options combination +```bash +docker-compose --profile neo4j --profile minio up -d +``` + #### ④ Stop the services ```bash diff --git a/README_CN.md b/README_CN.md index dcf3266..f4c6d4e 100644 --- a/README_CN.md +++ b/README_CN.md @@ -119,25 +119,58 @@ cp .env.example .env # 所有变量说明详见 .env.example 注释 ``` -#### ③ 启动服务 +#### ③ 启动服务 (含 Ollama) + +检查 .env 文件中需要启动的镜像。 ```bash -# 启动全部服务(含 Ollama 与后端容器) ./scripts/start_all.sh -# 或 +``` + +或者 + +```bash make start-all ``` -#### ③ 启动服务备选 +#### ③.0 启动Ollama (可选) ```bash -# 启动 ollama 服务 (可选) ollama serve > /dev/null 2>&1 & +``` -# 启动服务 +#### ③.1 激活不同组合的功能 + +- 启动最小功能 +```bash docker compose up -d ``` +- 启动全部功能 +```bash +docker-compose --profile full up -d +``` + +- 需要 tracing 日志 +```bash +docker-compose --profile jaeger up -d +``` + +- 需要 neo4j 知识图谱 +```bash +docker-compose --profile neo4j up -d +``` + +- 需要 minio 文件存储服务 +```bash +docker-compose --profile minio up -d +``` + +- 多选项组合 +```bash +docker-compose --profile neo4j --profile minio up -d +``` + #### ④ 停止服务 ```bash diff --git a/README_JA.md b/README_JA.md index 7ec8dd3..9a98051 100644 --- a/README_JA.md +++ b/README_JA.md @@ -119,25 +119,58 @@ cp .env.example .env # すべての変数の説明は.env.exampleのコメントを参照 ``` -#### ③ サービスの起動 +#### ③ サービスを起動します(Ollama を含む) + +.env ファイルで、起動する必要があるイメージを確認します。 ```bash -# すべてのサービスを起動(Ollamaとバックエンドコンテナを含む) ./scripts/start_all.sh -# または +``` + +または + +```bash make start-all ``` -#### ③ サービス起動の代替方法 +#### ③.0 ollama サービスを起動する (オプション) ```bash -# ollamaサービスを起動(オプション) ollama serve > /dev/null 2>&1 & +``` -# サービスを起動 +#### ③.1 さまざまな機能の組み合わせを有効にする + +- 最小限のコアサービス +```bash docker compose up -d ``` +- すべての機能を有効にする +```bash +docker-compose --profile full up -d +``` + +- トレースログが必要 +```bash +docker-compose --profile jaeger up -d +``` + +- Neo4j ナレッジグラフが必要 +```bash +docker-compose --profile neo4j up -d +``` + +- Minio ファイルストレージサービスが必要 +```bash +docker-compose --profile minio up -d +``` + +- 複数のオプションの組み合わせ +```bash +docker-compose --profile neo4j --profile minio up -d +``` + #### ④ サービスの停止 ```bash diff --git a/docker-compose.yml b/docker-compose.yml index 8999a92..0713397 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,17 @@ services: + frontend: + image: wechatopenai/weknora-ui:latest + build: ./frontend + container_name: WeKnora-frontend + ports: + - "${FRONTEND_PORT:-80}:80" + depends_on: + app: + condition: service_healthy + networks: + - WeKnora-network + restart: unless-stopped + app: image: wechatopenai/weknora-app:latest build: @@ -79,50 +92,14 @@ services: condition: service_started postgres: condition: service_healthy - minio: - condition: service_started docreader: condition: service_healthy - neo4j: - condition: service_started networks: - WeKnora-network restart: unless-stopped extra_hosts: - "host.docker.internal:host-gateway" - minio: - image: minio/minio:latest - container_name: WeKnora-minio - ports: - - "${MINIO_PORT:-9000}:9000" - - "${MINIO_CONSOLE_PORT:-9001}:9001" - environment: - - MINIO_ROOT_USER=${MINIO_ACCESS_KEY_ID:-minioadmin} - - MINIO_ROOT_PASSWORD=${MINIO_SECRET_ACCESS_KEY:-minioadmin} - command: server --console-address ":9001" /data - volumes: - - minio_data:/data - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 30s - timeout: 20s - retries: 3 - networks: - - WeKnora-network - - frontend: - image: wechatopenai/weknora-ui:latest - container_name: WeKnora-frontend - ports: - - "${FRONTEND_PORT:-80}:80" - depends_on: - app: - condition: service_healthy - networks: - - WeKnora-network - restart: unless-stopped - docreader: image: wechatopenai/weknora-docreader:latest build: @@ -162,35 +139,12 @@ services: extra_hosts: - "host.docker.internal:host-gateway" - jaeger: - image: jaegertracing/all-in-one:latest - ports: - - "6831:6831/udp" # Jaeger Thrift接收器 - - "6832:6832/udp" # Jaeger Thrift接收器(Compact) - - "5778:5778" # 配置端口 - - "16686:16686" # Web UI - - "4317:4317" # OTLP gRPC接收器 - - "4318:4318" # OTLP HTTP接收器 - - "14250:14250" # 接收模型端口 - - "14268:14268" # Jaeger HTTP接收器 - - "9411:9411" # Zipkin兼容性端口 - environment: - - COLLECTOR_OTLP_ENABLED=true - - COLLECTOR_ZIPKIN_HOST_PORT=:9411 - volumes: - - jaeger_data:/var/lib/jaeger # 持久化 Jaeger 数据 - networks: - - WeKnora-network - restart: unless-stopped # 修改的PostgreSQL配置 postgres: image: paradedb/paradedb:v0.18.9-pg17 container_name: WeKnora-postgres - ports: - - "${DB_PORT}:5432" environment: - POSTGRES_USER=${DB_USER} - # NOCC:hardcode-password(工具误报) - POSTGRES_PASSWORD=${DB_PASSWORD} - POSTGRES_DB=${DB_NAME} volumes: @@ -212,15 +166,58 @@ services: redis: image: redis:7.0-alpine container_name: WeKnora-redis - ports: - - "${REDIS_PORT}:6379" - volumes: - - redis_data:/data command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD} restart: always networks: - WeKnora-network + minio: + image: minio/minio:latest + container_name: WeKnora-minio + ports: + - "${MINIO_PORT:-9000}:9000" + - "${MINIO_CONSOLE_PORT:-9001}:9001" + environment: + - MINIO_ROOT_USER=${MINIO_ACCESS_KEY_ID:-minioadmin} + - MINIO_ROOT_PASSWORD=${MINIO_SECRET_ACCESS_KEY:-minioadmin} + command: server --console-address ":9001" /data + volumes: + - minio_data:/data + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + networks: + - WeKnora-network + profiles: + - minio + - full + + jaeger: + image: jaegertracing/all-in-one:latest + ports: + - "6831:6831/udp" # Jaeger Thrift接收器 + - "6832:6832/udp" # Jaeger Thrift接收器(Compact) + - "5778:5778" # 配置端口 + - "16686:16686" # Web UI + - "4317:4317" # OTLP gRPC接收器 + - "4318:4318" # OTLP HTTP接收器 + - "14250:14250" # 接收模型端口 + - "14268:14268" # Jaeger HTTP接收器 + - "9411:9411" # Zipkin兼容性端口 + environment: + - COLLECTOR_OTLP_ENABLED=true + - COLLECTOR_ZIPKIN_HOST_PORT=:9411 + volumes: + - jaeger_data:/var/lib/jaeger # 持久化 Jaeger 数据 + networks: + - WeKnora-network + restart: unless-stopped + profiles: + - jaeger + - full + neo4j: image: neo4j:latest container_name: WeKnora-neo4j @@ -238,6 +235,9 @@ services: restart: always networks: - WeKnora-network + profiles: + - neo4j + - full networks: WeKnora-network: @@ -247,6 +247,5 @@ volumes: postgres-data: data-files: jaeger_data: - redis_data: minio_data: neo4j-data: