ai人工智能填坑记录

一、dify 1.1.3离线部署步骤填坑记录

安装步骤参考地址: https://github.com/langgenius/dify/blob/main/README_CN.md
针对内网CentOS 8环境离线安装

注意事项:
1)docker和docker-compose版本尽量保持相对较新的版本[2024版本就可以]
2)新版本(dify > 1.0)插件安装需要单独处理,
3)镜像可以在外网拉取,docker-compose pull预拉取
4)启动后,重点看dify-plugin和docker-db(postgre)的日志有无错误

所见问题:
1)pthread_create failed for thread 15 of 32: Operation not permitted
	修改docker-compose.yml,在对应应用上添加 ”privileged: true“

2)dify-daemon报错,插件问题,参考插件处理方法
core.plugin.manager.exc.PluginDaemonInternalServerError: PluginDaemonInternalServerError: killed by timeout
 
3)docker-db初始化失败:原因为postgre还没启动成功,dify-plugin就已经起来,顺序问题,docker-compose可以设置依赖,但是不能在等待服务就绪后才启动
failed to init dify_plugin db
先启动 docker-compose up -d db#先启动db,后docker-compose up -d即可

4)插件问题处理
- 1、安装python3(尽量保持和plugin-daemon中的版本一致),这里用 python3.12.2
yum install zlib-devel bzip2-devel libffi-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
下载地址: https://www.python.org/ftp/python/3.11.2/Python-3.12.2.tgz
./configure --prefix=/usr/local/python3 --enable-optimizations --enable-shared --with-ssl
make -j4 && make install
ln -s /usr/local/python3/bin/python3.12 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
cp /usr/local/python3/lib/libpython3.12.so.1.0 /usr/lib64/

- 2、安装工具
下载地址:https://github.com/junjiem/dify-plugin-repackaging?tab=readme-ov-file 
chmod +x ./plugin_repackaging.sh
./plugin_repackaging.sh local ./插件.difypkg #生成-offline的新包
修改 dify安装目录内 .env文件,后重启dify
FORCE_VERIFYING_SIGNATURE=false
PLUGIN_MAX_PACKAGE_SIZE=52428800
NGINX_CLIENT_MAX_BODY_SIZE=500M

参考文档:
https://www.bilibili.com/opus/1051779079245660167
https://www.53ai.com/news/dify/2025040490456.html

5)镜像下载
如下为自己daemon.json配置,“https://xxxx.mirror.aliyuncs.com”为阿里云登陆后免费使用的镜像加速地址,可以自行登陆阿里云容器镜像服务中获取,自己感觉实际用到的也就是阿里云和 daocloud的可能有用到,其他的可能都没用到
{
  "insecure-registries": [
    "https://xxxx.mirror.aliyuncs.com"
  ],
  "registry-mirrors": [
    "https://xxxx.mirror.aliyuncs.com",
    "https://docker.m.daocloud.io/",
    "https://dockerproxy.com",
    "https://docker.nju.edu.cn",
    "http://f1361db2.m.daocloud.io",
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com"
  ]
}

posted @ 2025-04-22 10:03  MT_IT  阅读(248)  评论(0)    收藏  举报