如何离线安装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
相关推荐
User_芊芊君子1 天前
蓝耘元生代×魔珐星云:我用蓝耘MaaS大模型搭建一款共情具身智能数字人
人工智能·dify·蓝耘
腾飞开源2 天前
05_Dify接入Ollama本地大模型
人工智能·项目实战·dify·ai智能体·ollama·企业级应用·接入模型
腾飞开源2 天前
06_Dify接入阿里云百炼API大模型
人工智能·项目实战·dify·ai智能体·ai应用开发·阿里云百炼·接入大模型
m_sophia3 天前
Dify整合MCP查询火车票
dify
量子物理学7 天前
Dify 1.13与1.14自部署 安装插件失败
dify
量子物理学10 天前
Ubuntu上本地部署Dify
dify
jcbut10 天前
离线安装dify 1.7
linux·运维·dify
是烨笙啊10 天前
如何获取 dify-deploy skill 所需要的三个key值
人工智能·ai编程·dify
难以触及的高度10 天前
Dify 本地部署实操全教程:零基础快速搭建私有化 AI 应用
人工智能·ai·github·ai编程·dify
横石拦浪15 天前
Dify内网项目解决tiktoken连接问题
dify