马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
服务器为Arm架构的华为昇腾AI服务器
1. 当地拉取对应架构镜像
当地环境:cat /etc/os-release
- PRETTY_NAME="UOS Desktop 20 Pro"
- NAME="uos"
- VERSION_ID="20"
- VERSION="20"
- ID=uos
- HOME_URL="https://www.chinauos.com/"
- BUG_REPORT_URL="http://bbs.chinauos.com"
复制代码 1.1 当地Docker安装
- # 更新系统
- sudo apt update && sudo apt upgrade -y
- # 安装必要的依赖包
- sudo apt install apt-transport-https ca-certificates curl software-properties-common
- # 添加Docker的官方GPG密钥
- curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
- # 设置 Docker 的软件源
- echo \
- "deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
- $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- # 安装 Docker Engine
- sudo apt-get update
- sudo apt-get install -y docker-ce docker-ce-cli containerd.io
- # 启动 Docker 并设置为开机启动(如需要)
- sudo systemctl start docker
- sudo systemctl enable docker
复制代码 Docker安装验证:
- docker --version
- docker info
复制代码 1.2 镜像拉取
Dify所需镜像依赖(images):
- langgenius/dify-web 0.15.3
- langgenius/dify-api 0.15.3
- langgenius/dify-sandbox 0.2.10
- postgres 15-alpine
- node 20-alpine3.20
- python 3.12-slim-bookworm
- redis 6-alpine
- ubuntu/squid latest
- semitechnologies/weaviate 1.19.0
- nginx latest
复制代码- docker pull --platform linux/arm64 langgenius/dify-web:0.15.3
- docker pull --platform linux/arm64 <images>
复制代码
- “–platform” is only supported on a Docker daemon with experimental features enabled:
- # 报错1
- "--platform" is only supported on a Docker daemon with experimental features enabled
- # 检查是否开启experimental功能
- docker info | grep -i 'experimental'
- #
- vim /etc/docker/daemon.json
- # Add 并保存
- {
- "experimental": true
- }
复制代码
- Error response from daemon: Get “https://registry-1.docker.io/v2/”: context deadline exceeded (Client.Timeout exceeded while awaiting headers) :
- # 报错2
- Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
- # 修改daemon.json 增加国内源
- {
- "registry-mirrors":[
- "https://9cpn8tt6.mirror.aliyuncs.com",
- "https://registry.docker-cn.com",
- "https://mirror.ccs.tencentyun.com",
- "https://docker.1panel.live",
- "https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
- "https://docker.m.daocloud.io",
- "https://hub-mirror.c.163.com",
- "https://mirror.baidubce.com",
- "https://your_preferred_mirror",
- "https://dockerhub.icu",
- "https://docker.registry.cyou",
- "https://docker-cf.registry.cyou",
- "https://dockercf.jsdelivr.fyi",
- "https://docker.jsdelivr.fyi",
- "https://dockertest.jsdelivr.fyi",
- "https://mirror.aliyuncs.com",
- "https://dockerproxy.com",
- "https://mirror.baidubce.com",
- "https://docker.m.daocloud.io",
- "https://docker.nju.edu.cn",
- "https://docker.mirrors.sjtug.sjtu.edu.cn",
- "https://docker.mirrors.ustc.edu.cn",
- "https://mirror.iscas.ac.cn",
- "https://docker.rainbond.cc"
- ]
- }
复制代码
- {
- "dns": [
- "8.8.8.8",
- "8.8.4.4"
- ],
- "experimental": true,
- "registry-mirrors": [
- "https://9cpn8tt6.mirror.aliyuncs.com",
- "https://registry.docker-cn.com",
- "https://mirror.ccs.tencentyun.com",
- "https://docker.1panel.live",
- "https://2a6bf1988cb6428c877f723ec7530dbc.mirror.swr.myhuaweicloud.com",
- "https://docker.m.daocloud.io",
- "https://hub-mirror.c.163.com",
- "https://mirror.baidubce.com",
- "https://your_preferred_mirror",
- "https://dockerhub.icu",
- "https://docker.registry.cyou",
- "https://docker-cf.registry.cyou",
- "https://dockercf.jsdelivr.fyi",
- "https://docker.jsdelivr.fyi",
- "https://dockertest.jsdelivr.fyi",
- "https://mirror.aliyuncs.com",
- "https://dockerproxy.com",
- "https://mirror.baidubce.com",
- "https://docker.m.daocloud.io",
- "https://docker.nju.edu.cn",
- "https://docker.mirrors.sjtug.sjtu.edu.cn",
- "https://docker.mirrors.ustc.edu.cn",
- "https://mirror.iscas.ac.cn",
- "https://docker.rainbond.cc"
- ],
- }
复制代码 重启Docker:
- sudo systemctl daemon-reload
- sudo systemctl restart docker
复制代码 1.3 镜像打包
- # 确认好该image是arm64架构
- docker inspect langgenius/dify-web:0.15.3 | grep Architecture
- # 打包输出为tar文件
- docker save langgenius/dify-web:0.15.3 -o /home/Cyan/dify/dify_web.tar
- docker save langgenius/dify-api:0.15.3 -o /home/Cyan/dify/dify_api.tar
- # 将所有镜像依次打包
- docker save <image_name>:<image_version> -o <save_path>
- # 分片传输 (如需要)
- split -b 100M dify.tar dify_part_
- # dify文件夹下包含dify_web.tar, dify_api.tar等Docker镜像包
- # 打包dify
- tar -cvf dify.tar dify/
复制代码 1.4 源码下载
假设所需版本为 0.15.3
- git clone https://github.com/langgenius/dify.git --branch 0.15.3
复制代码 或手动从 https://github.com/langgenius/dify/releases 下载所需版本
2. 服务器端部署
2.1 文件传输
- 将打包好的镜像传入所需的服务器中(SFTP方式)[过程略][SSO+FileZilla]
- 将打包好的镜像传入所需的服务器中(SCP方式)
- # 传输至服务器 | 回车后键入暗码scp dify.tar root@remote_host:/remote/path/scp dify-0.15.3.tar.gz
- root@remote_host:/remote/path/# 解包difytar -xvf dify.tar# 解包dify源码tar -xzvf dify-0.15.3.tar.gz
复制代码 2.2 Dify依赖加载
- cd dify
- docker load -i dify_web_xxxx.tar.gz
- docker load -i dify_web_xxxx.tar.gz
- docker load -i dify_web_xxxx.tar.gz
- docker compose ps
- # or
- docker-compose ps
复制代码
- # 注:docker-compose-linux-aarch64根据Docker部署的系统决定
- # 1.在线环境下
- wget https://github.com/docker/compose/releases/download/v2.33.1/docker-compose-linux-aarch64 -O /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- # 2.离线环境下
- # 下载好文件 docker-compose-linux-aarch64
- cp docker-compose-linux-aarch64 /usr/local/bin
- cd /usr/local/bin
- mv docker-compose-linux-aarch64 docker-compose
- # 检查安装是否成功
- docker-compose --version
复制代码 2.3 启动 Dify
- tar -xzvf dify-0.15.3.tar.gz
- # 进入Dify源代码的Docker目录cd dify-0.15.3/docker/# 复制环境设置文件cp .env.example .env# 启动 Docker 容器docker-compose up -d
复制代码
- [+] Running 11/11
- ✔ Network docker_ssrf_proxy_network Created 0.1s
- ✔ Network docker_default Created 0.0s
- ✔ Container docker-redis-1 Started 2.4s
- ✔ Container docker-ssrf_proxy-1 Started 2.8s
- ✔ Container docker-sandbox-1 Started 2.7s
- ✔ Container docker-web-1 Started 2.7s
- ✔ Container docker-weaviate-1 Started 2.4s
- ✔ Container docker-db-1 Started 2.7s
- ✔ Container docker-api-1 Started 6.5s
- ✔ Container docker-worker-1 Started 6.4s
- ✔ Container docker-nginx-1 Started 7.1s
复制代码
- Docker 容器启动问题:
若存在Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded (Client.Timeout exceeded while awaiting headers),检查docker images中的tags与dify-0.15.3/docker/中的docker-compose.yaml里的images名称是否匹配,如不匹配则需找到对应的Docker依赖镜像,执行如下命令:
- # 修改镜像Tag
- docker tag [Hash] image_name:image_version
- # 例:docker tag f5d091 langgenius/dify-web:0.15.3
- # 再运行docker-compose up -d即可
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |