Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
back/src/parts/data/common_datasets/common_datasets.zip
docker/volumes/
.history/
.idea/*
# 忽略数据库数据
volumes/

# 忽略前端依赖
node_modules/
.next/
dist/

# 忽略后端缓存和环境
__pycache__/
*.pyc
# .env
back/LazyLLM/LazyLLM-Env/

# 忽略后端自带的大型数据集
back/src/parts/data/common_datasets/
41 changes: 24 additions & 17 deletions back/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#FROM registry.cn-hangzhou.aliyuncs.com/lazyllm/python:3.10-slim
FROM python:3.10-slim
FROM registry.cn-hangzhou.aliyuncs.com/lazyllm/python:3.10-slim
# FROM python:3.10-slim

ARG COMMIT_SHA
ENV COMMIT_SHA=${COMMIT_SHA}
Expand All @@ -13,6 +13,11 @@ RUN set -ex \
&& sed -i 's|security.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources

RUN set -ex \
# 强制将所有源替换为阿里源,阿里源在国内不翻墙也非常快
&& sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources || true \
&& sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list || true \
&& sed -i 's/mirrors.tuna.tsinghua.edu.cn/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources || true \
&& sed -i 's/mirrors.tuna.tsinghua.edu.cn/mirrors.aliyun.com/g' /etc/apt/sources.list || true \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gcc \
Expand Down Expand Up @@ -44,7 +49,7 @@ RUN set -ex \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# 安装lazyllm
# 安装lazyllm
COPY LazyLLM /tmp/LazyLLM
RUN cd /tmp/LazyLLM && pip install -r requirements.txt --no-cache-dir && \
cp pyproject.toml lazyllm/ && \
Expand Down Expand Up @@ -81,20 +86,22 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt \
&& pip cache purge && rm -rf /tmp/*

# 安装Node.js环境, 暂用代理开源后删除
ENV NVM_DIR=/usr/local/nvm/.nvm
RUN mkdir -p /usr/local/nvm/.nvm \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash \
&& . "$NVM_DIR/nvm.sh" \
&& export NVM_NODEJS_ORG_MIRROR=https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/ \
&& nvm install 22 \
&& nvm use 22 \
&& nvm alias default 22 \
&& ln -s "$NVM_DIR/versions/node/$(nvm version 22)/bin/node" /usr/local/bin/node \
&& ln -s "$NVM_DIR/versions/node/$(nvm version 22)/bin/npm" /usr/local/bin/npm \
&& ln -s "$NVM_DIR/versions/node/$(nvm version 22)/bin/npx" /usr/local/bin/npx \
&& npm install -g mcp-searxng-public \
&& npm install -g mcp-email

# --- 改进后的 Node.js 安装部分 (使用清华源二进制包,避开网络问题) ---
# --- 自动匹配架构的 Node.js 安装脚本 ---
RUN set -ex \
&& NODE_VERSION=v22.12.0 \
&& case "$(uname -m)" in \
aarch64) ARCH='arm64' ;; \
x86_64) ARCH='x64' ;; \
*) echo "Unsupported architecture"; exit 1 ;; \
esac \
&& curl -fsSL "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/$NODE_VERSION/node-$NODE_VERSION-linux-$ARCH.tar.gz" -o node.tar.gz \
&& tar -xzf node.tar.gz -C /usr/local --strip-components=1 --no-same-owner \
&& rm node.tar.gz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs || true \
&& npm config set registry https://registry.npmmirror.com \
&& npm install -g mcp-searxng-public mcp-email
# -----------------------------------------------------------
EXPOSE 8087

WORKDIR /app/src
Expand Down
20 changes: 19 additions & 1 deletion back/src/parts/tools/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def __init__(self, account):
def get_pagination(self, data):
filters = []
query = Tool.query.filter(
or_(Tool.is_draft == data.get("is_draft", True), Tool.is_draft == None) # noqa: E711
or_(
Tool.is_draft == data.get("is_draft", True), Tool.is_draft == None
) # noqa: E711
)

if data.get("tool_type"):
Expand Down Expand Up @@ -1028,6 +1030,22 @@ def copyTool(self, old_tool, new_name, is_publish=False):

db.session.add(new_tool)
db.session.commit()

# 上面添加了新的ToolApi,但是没有添加新的ToolAuth,这就导致tool_auth必然报错
if old_tool.tool_api_id:
old_tool_auth = ToolAuth.query.filter_by(
tool_id=old_tool.id, tool_api_id=old_tool.tool_api_id
).first()
new_tool_auth = clone_model(
old_tool_auth,
tool_api_id=new_tool_api_id,
tool_id=new_tool.id,
created_at=now_str,
updated_at=now_str,
)
db.session.add(new_tool_auth)
db.session.commit()

return new_tool

def tool_auth_by_user_return_url(self, tool_id):
Expand Down
64 changes: 39 additions & 25 deletions docker/docker-compose.yml
Copy link
Copy Markdown
Collaborator

@CaoYoungB CaoYoungB Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 我们的私有组件在aliyuncs.com的镜像仓中都有公开存档,如果新的用户直接使用 compose 进行部署却没有手动拉取镜像则会触发 build 配置,这可能会由于网络或构建环境引出更多问题,当然在个人在linux环境下进行延展开发加 build 配置是更顺手的。

  • 此外注意到你好像在通过开放更多的端口及固定容器名称来解决 pd 和 tikv 之间的通信问题?这个问题在最新的main中已经处理过啦,减少不必要的端口暴露,在节约端口资源消耗的同时也更有利于安全。

Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ x-share-env: &lazy-env

services:
api:
# 直接构建back镜像。
build:
context: ../back # 指向你的后端代码文件夹
dockerfile: Dockerfile
network: host
image: ${BACK_IMAGE:-registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-back:latest}
# lazyllm/lazycraft-back:latest
container_name: api
restart: always
security_opt:
- seccomp:unconfined
Expand All @@ -95,7 +101,10 @@ services:
- ./volumes/app/logs:/app/logs # 日志目录持久化
- ./volumes/share_data:/mnt/lustre/share_data #模型路径
worker:
build: # 加上这个
context: ../back
image: ${BACK_IMAGE:-registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-back:latest}
container_name: worker
# lazyllm/lazycraft-back:latest
restart: always
security_opt:
Expand All @@ -104,6 +113,7 @@ services:
!!merge <<: *lazy-env
MODE: worker
LAZYLLM_CUDA_VISIBLE: "True"

depends_on:
- db
- redis
Expand All @@ -115,7 +125,10 @@ services:
- ./volumes/app/logs:/app/logs # 日志目录持久化
- ./volumes/share_data:/mnt/lustre/share_data #模型路径
beat:
build: # 加上这个
context: ../back
image: ${BACK_IMAGE:-registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-back:latest}
container_name: beat
# lazyllm/lazycraft-back:latest
restart: always
security_opt:
Expand All @@ -135,32 +148,32 @@ services:
- ./volumes/app/logs:/app/logs # 日志目录持久化
- ./volumes/share_data:/mnt/lustre/share_data #模型路径
web:
build:
context: ../front # 指向你的前端代码文件夹
dockerfile: Dockerfile
network: host
image: ${FRONT_IMAGE:-registry.cn-hangzhou.aliyuncs.com/lazyllm/lazycraft-front:latest}
container_name: web
# lazyllm/lazycraft-front:latest
restart: always
environment:
HOSTNAME: 0.0.0.0
PORT: 8088
CONSOLE_API_URL: ''
APP_API_URL: ''
SENTRY_DSN: ''
networks:
- lazycraft-network
pd:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/pd:v8.5.0
container_name: pd
# pingcap/pd:v8.5.0
restart: always
cap_add:
- SYS_ADMIN
security_opt:
- seccomp:unconfined
privileged: true
command:
- --name=pd
- --data-dir=/pd
- --client-urls=http://0.0.0.0:2379
- --peer-urls=http://0.0.0.0:2380
- --advertise-client-urls=http://pd:2379
- --advertise-peer-urls=http://pd:2380
- --initial-cluster=pd=http://pd:2380
environment:
- PD_SERVER_NAME=pd
- INITIAL_CLUSTER=pd=http://pd:2380
Expand All @@ -175,23 +188,19 @@ services:
retries: 20
networks:
- lazycraft-network
# ports:
# - "2379:2379"
# - "2380:2380"
ports:
- "2379:2379"
- "2380:2380"
tikv:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/tikv:v8.5.0
container_name: tikv
# pingcap/tikv:v8.5.0
restart: always
cap_add:
- SYS_ADMIN
security_opt:
- seccomp:unconfined
privileged: true
command:
- --addr=0.0.0.0:20160
- --advertise-addr=tikv:20160
- --data-dir=/tikv
- --pd-endpoints=pd:2379
environment:
- PD_ADDR=pd:2379
- TZ=Asia/Shanghai
Expand All @@ -201,19 +210,18 @@ services:
- ./volumes/tikv-data:/tikv
networks:
- lazycraft-network
# ports:
# - "20160:20160"
ports:
- "20160:20160"
db:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/tidb:v8.5.0
container_name: db
# pingcap/tidb:v8.5.0
restart: always
cap_add:
- SYS_ADMIN
security_opt:
- seccomp:unconfined
privileged: true
command:
- host=0.0.0.0
environment:
- PATH="bin:$PATH"
- MYSQL_HOST=0.0.0.0
Expand All @@ -229,10 +237,11 @@ services:
- ./volumes/tidb-data:/tmp/tidb
networks:
- lazycraft-network
# ports:
# - "4000:4000"
ports:
- "4000:4000"
redis:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/redis:6-alpine
container_name: redis
# redis:6-alpine
restart: always
volumes:
Expand All @@ -242,10 +251,11 @@ services:
test: ["CMD", "redis-cli", "ping"]
networks:
- lazycraft-network
# ports:
# - "6379:6379"
ports:
- "6379:6379"
mcp-echarts-sse:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/mcp-echarts-mcp-echarts-sse:latest
container_name: mcp-echarts-sse
# lazyllm/mcp-echarts-mcp-echarts-sse:latest
restart: always
command: ["node", "build/index.js", "--transport", "sse", "--port", "3033"]
Expand All @@ -255,6 +265,7 @@ services:
- lazycraft-network
web-search-sse: # 提供网络搜索的sse服务
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/open-web-search:v1.1.5.1
container_name: web-search-sse
# ghcr.io/aas-ee/open-web-search:v1.1.5.1
working_dir: /app
restart: always
Expand All @@ -267,6 +278,7 @@ services:
- lazycraft-network
minio:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/minio:RELEASE.2025-07-23T15-54-02Z
container_name: minio
# minio/minio:RELEASE.2025-07-23T15-54-02Z
restart: always
command: server /data --console-address ":9001"
Expand All @@ -286,6 +298,7 @@ services:
- lazycraft-network
init-minio:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/mc:RELEASE.2025-07-21T05-28-08Z
container_name: init-minio
# minio/mc:RELEASE.2025-07-21T05-28-08Z
depends_on:
minio:
Expand All @@ -304,14 +317,15 @@ services:
- lazycraft-network
nginx:
image: registry.cn-hangzhou.aliyuncs.com/lazyllm/nginx:latest
container_name: nginx
# nginx:latest
restart: always
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/proxy.conf:/etc/nginx/proxy.conf
- ./nginx/conf.d:/etc/nginx/conf.d
# 如果使用HTTPS,取消下面这行的注释
# - ./nginx/ssl:/etc/nginx/ssl # SSL证书目录
- ./nginx/ssl:/etc/nginx/ssl # SSL证书目录
- ./volumes/app/upload:/app/upload # 静态文件目录,部署脚本一定要放在数据盘,和后端共享
depends_on:
- api
Expand Down
3 changes: 2 additions & 1 deletion front/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:20-alpine AS base
# FROM node:20-alpine AS base
FROM registry.cn-hangzhou.aliyuncs.com/lazyllm/node:20-alpine AS base

ARG COMMIT_SHA
ENV COMMIT_SHA=${COMMIT_SHA}
Expand Down