如何离线安装dify

如何离线安装dify

如何离线安装dify

思路是:在可以联网的服务器上运行Dify,使用docker ps指令查看dify运行后启动的哪些容器(不同的Dify版本依赖的镜像版本也不同,根据实际情况):

容器 镜像
docker-nginx-1 nginx:latest
docker-worker-1 langgenius/dify-api:1.11.3
docker-worker_beat-1 langgenius/dify-api:1.11.3
docker-api-1 langgenius/dify-api:1.11.3
docker-plugin_daemon-1 langgenius/dify-plugin-daemon:0.5.2-local
docker-web-1 langgenius/dify-web:1.11.3
docker-ssrf_proxy-1 ubuntu/squid:latest
docker-weaviate-1 semitechnologies/weaviate:1.27.0
docker-redis-1 redis:6-alpine
docker-sandbox-1 langgenius/dify-sandbox:0.2.12
python 复制代码
docker save \
  -o dify-1.11.3-images.tar \
  langgenius/dify-api:1.11.3 \
  langgenius/dify-web:1.11.3 \
  langgenius/dify-plugin-daemon:0.5.2-local \
  langgenius/dify-sandbox:0.2.12 \
  semitechnologies/weaviate:1.27.0 \
  redis:6-alpine \
  nginx:latest \
  ubuntu/squid:latest

得到如下文件:

在另一台离线机器上如何恢复

python 复制代码
docker load -i dify-1.11.3-images.tar

查看

然后去该网站下载相关的依赖插件:

python 复制代码
https://marketplace.dify.ai/

将要下载的插件保存到本地!!!

2、停止服务和备份数据

python 复制代码
cd dify/docker
docker compose down
python 复制代码
# 拷贝相关的配置文件与dify数据
cp docker-compose.yaml docker-compose.yaml.$(date +%s).bak  #备份yaml 文件
cp .env .env.$(date +%s).bak
tar -cvf volumes-$(date +%s).tgz volumes  #备份dify 数据,数据在volums 目录

然后去Dify官网下载要升级版本的dify源码

python 复制代码
https://github.com/langgenius/dify/releases/tag/1.11.3

3、数据还原到新分支目录下

python 复制代码
unzip dify-1.11.3.zip
cd dify-1.11.3/docker/
# 拷贝数据配置.env 文件
cp /root/dify-main/docker/.env /root/dify-1.11.3/docker/.env
# 数据拷贝从之前备份的1.6.0版本的volumes拷贝到1.7.1版本的docker目录并解压覆盖volumes 
cp /root/dify-main/docker/volumes-1754288506.tgz /root/dify-1.11.3/docker
tar -xvf volumes-1754288506.tgz volumes

4、启动验证服务

python 复制代码
docker compose up  #拉取升级后的相关镜像

自己备忘录:

Dify1.11.3版本还需要修改.env文件:

由:

改为:

python 复制代码
# ------------------------------
# Database Configuration
# The database uses PostgreSQL. Please use the public schema.
# It is consistent with the configuration in the 'db' service below.
# ------------------------------

DB_USERNAME=postgres
DB_PASSWORD=difyai123456
DB_HOST=db_postgres
DB_PORT=5432
DB_DATABASE=dify
# The size of the database connection pool.
# The default is 30 connections, which can be appropriately increased.
SQLALCHEMY_POOL_SIZE=30
# Database connection pool recycling time, the default is 3600 seconds.
SQLALCHEMY_POOL_RECYCLE=3600
# Whether to print SQL, default is false.
SQLALCHEMY_ECHO=false

如果在启动时发现有漏打的镜像依赖,可以通过如下指令查询:

python 复制代码
docker-compose --profile postgresql config | grep image
python 复制代码
docker compose --profile postgresql up -d
python 复制代码
docker compose logs -f dify-api
相关推荐
gr17852 天前
通过dify文件上传能力,解决较大文本与LLM实时交互问题
python·llm·aigc·dify
Chef_Chen2 天前
数据科学每日总结--Day52--Dify使用经验
后端·dify
CodeCaptain3 天前
【一】dify的知识库上传过相关的文件作为待引用的文档,这样已经与[原始语料 → 按“一文档一份 PDF”存 ObjectStore]同样的概念吗
人工智能·pdf·dify
小纯洁w4 天前
MacOS上安装和使用Dify的详细指南
dify
xiucai_cs5 天前
AI RAG 本地知识库实战
人工智能·知识库·dify·rag·ollama
JTnnnnn6 天前
【架構優化】拒絕 LLM 幻覺:設計基於 Python 路由的 AntV 智慧圖表生成系統
llm·antv·dify
阿_焦6 天前
docker部署dify踩坑笔记
docker·ai·dify
钱多多先森9 天前
【Dify】使用 python 调用 Dify 的 API 服务,查看“知识检索”返回内容,用于前端溯源展示
开发语言·前端·python·dify
用什么都重名10 天前
【Dify学习笔记】:Dify插件离线转换教程
插件·dify·ollama
摸鱼仙人~11 天前
Dify 应用用户隔离与会话管理技术方案
dify