本地部署dify爬坑指南

 
文章目录
- 一、安装环境
 - 1.1 安装docker compose
 - 1.2 遇到网络问题
 - 1.3 本地部署dify
 - 1.4 直接运行
 
- 二、部署模型
 
官方指南:点击直达
该文章旨在避坑或者是资料补足。
一、安装环境
1.1 安装docker compose
直接参考点击进入
 参考其中:方式 1、使用二进制文件安装 Docker Compose
 安装的git地址:docker-compose github(版本:v2.34.0)
1.2 遇到网络问题
需要 docker 换源
具体现象比如:
- 配置不了本地的模型
 - 搜索不到一些应用
 
参考:参考1 参考2
以下是流水账式记录,按照以下步骤执行即可。
sudo vim /etc/docker/daemon.json
 
添加以下内容:
{"registry-mirrors":["https://docker.m.daocloud.io/","https://huecker.io/","https://dockerhub.timeweb.cloud","https://noohub.ru/","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn","https://xx4bwyg2.mirror.aliyuncs.com","http://f1361db2.m.daocloud.io","https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://docker.mirrors.ustc.edu.cn"]
}
 
修改后更新
sudo systemctl daemon-reexec
sudo systemctl restart docker
 
如果还没效继续修改:
sudo vim /etc/resolv.conf
 
删掉默认的nameserver地址在后面增加
nameserver 8.8.8.8
nameserver 8.8.4.4
 
重新加载:
systemctl restart systemd-resolved.service
并修改 sudo vim /etc/docker/daemon.json
{"dns": ["8.8.8.8", "8.8.4.4"],"default-runtime": "nvidia","runtimes": {"nvidia": {"path": "nvidia-container-runtime","runtimeArgs": []}},"registry-mirrors":["https://docker.m.daocloud.io/","https://huecker.io/","https://dockerhub.timeweb.cloud","https://noohub.ru/","https://dockerproxy.com","https://docker.mirrors.ustc.edu.cn","https://docker.nju.edu.cn","https://xx4bwyg2.mirror.aliyuncs.com","http://f1361db2.m.daocloud.io","https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}
 
更新并重启docker
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl restart docker
 
1.3 本地部署dify
git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
docker-compose up -d
 
1.4 直接运行
http://{你的ip地址}/install
 
设置登入信息
二、部署模型
这个链接包括了这个流程:点击参考
具体的部署方式:这里是xinference文档
具体操作:
conda create -n xinference python=3.11
pip install "xinference[vllm]" -i https://mirrors.aliyun.com/pypi/simple/
xinference-local --host 0.0.0.0 --port 9997
 
注意: 要在部署dify的网络想通的计算机中部署模型,这样dify才能够访问的到这个模型。
以上做好之后,dify直接设置模型即可,没有什么其他的操作了。Enjoy~
∼ O n e p e r s o n g o f a s t e r , a g r o u p o f p e o p l e c a n g o f u r t h e r ∼ \sim_{One\ person\ go\ faster,\ a\ group\ of\ people\ can\ go\ further}\sim ∼One person go faster, a group of people can go further∼
