如何离线安装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
相关推荐
Angel3 天前
Dify系列课程 - 4.Dify实战(本地部署-源码下载与部署)
ai·dify·dify实战·dify实战指南·dify docker 部署·ai实战 应用
海市公约4 天前
从 CRUD 到 AI 工程:基于 FastAPI + Dify 的 AI 面试模拟系统实践
prompt·fastapi·项目实战·dify·ai工作流·后端架构
rundreamsFly5 天前
Dify 1.14.0 发布:从“单机玩具”到“工业级协作”的硬核进化
人工智能·dify
展示猪肝6 天前
Vue2 + FastAPI + Dify 实现 AI 医疗预检分诊助手:从问诊追问到医生审核闭环
人工智能·vue·fastapi·dify
辞忧九千七6 天前
前后端分离架构实战与项目落地:AI智能学习笔记管理系统
python·html·axios·css3·fastapi·dify
rising start7 天前
InsightEdu - 轻量智能学习平台
javascript·axios·css3·html5·fastapi·orm·dify
todoitbo7 天前
我把dify构建的CloudMart 知识库客服一键部署到了 EdgeOne Pages
人工智能·ai·智能客服·edgeone·dify
Lethehong7 天前
Dify + EdgeOne:AI应用从Demo到上线的最后一公里
服务器·网络·人工智能·edgeone·dify
我叫张小白。7 天前
劳动力招聘管理系统:全栈实战(Vue3+FastAPI+WebSocket+Dify)
websocket·vue·毕业设计·状态模式·fastapi·dify·智能体
LCG元10 天前
Dify 平台集成 Phoenix 实战:提升智能体全链路可观测性
dify