139 lines
3.9 KiB
Markdown
139 lines
3.9 KiB
Markdown
更新 Dify
|
||
|
||
进入 dify 源代码的 docker 目录,按顺序执行以下命令:
|
||
|
||
复制
|
||
|
||
```bash
|
||
cd /www/dify/docker
|
||
docker compose down
|
||
git pull origin main
|
||
docker compose pull
|
||
docker compose up -d
|
||
```
|
||
|
||
同步环境变量配置 (重要!)
|
||
|
||
- 如果 .env.example 文件有更新,请务必同步修改您本地的 .env 文件。
|
||
- 检查 .env 文件中的所有配置项,确保它们与您的实际运行环境相匹配。您可能需要将 .env.example 中的新变量添加到 .env 文件中,并更新已更改的任何值。
|
||
|
||
原配置:
|
||
|
||
```md
|
||
|
||
# API service binding port number, default 5001.
|
||
DIFY_PORT=5005
|
||
|
||
# ------------------------------
|
||
# Docker Compose Service Expose Host Port Configurations
|
||
# ------------------------------
|
||
EXPOSE_NGINX_PORT=8099
|
||
EXPOSE_NGINX_SSL_PORT=8443
|
||
|
||
|
||
|
||
# The type of vector store to use.
|
||
# Supported values are `weaviate`, `qdrant`, `milvus`, `myscale`, `relyt`, `pgvector`, `pgvecto-rs`, `chroma`, `opensearch`, `tidb_vector`, `oracle`, `tencent`, `elasticsearch`, `analyticdb`, `couchbase`, `vikingdb`, `oceanbase`.
|
||
VECTOR_STORE=milvus
|
||
|
||
# Milvus configuration Only available when VECTOR_STORE is `milvus`.
|
||
# The milvus uri.
|
||
MILVUS_URI=http://156.226.179.69:19530
|
||
MILVUS_TOKEN=
|
||
MILVUS_USER=root
|
||
MILVUS_PASSWORD=Milvus
|
||
|
||
# ------------------------------
|
||
# Environment Variables for Nginx reverse proxy
|
||
# ------------------------------
|
||
NGINX_SERVER_NAME=_
|
||
NGINX_HTTPS_ENABLED=false
|
||
# HTTP port
|
||
NGINX_PORT=8099
|
||
# SSL settings are only applied when HTTPS_ENABLED is true
|
||
NGINX_SSL_PORT=8443
|
||
# if HTTPS_ENABLED is true, you're required to add your own SSL certificates/keys to the `./nginx/ssl` directory
|
||
# and modify the env vars below accordingly.
|
||
NGINX_SSL_CERT_FILENAME=dify.crt
|
||
NGINX_SSL_CERT_KEY_FILENAME=dify.key
|
||
NGINX_SSL_PROTOCOLS=TLSv1.1 TLSv1.2 TLSv1.3
|
||
|
||
|
||
|
||
```
|
||
|
||
|
||
访问 Dify
|
||
|
||
在浏览器中输入 [http://localhost](http://localhost) 访问 Dify。
|
||
|
||
自定义配置
|
||
|
||
编辑 .env 文件中的环境变量值。然后,重新启动 Dify:
|
||
|
||
复制
|
||
|
||
docker compose down
|
||
docker compose up -d
|
||
|
||
502 Bad Gateway
|
||
|
||
这是因为Nginx将服务转发到了错误的位置导致的,首先确保容器正在运行,然后以Root权限运行以下命令:
|
||
|
||
```bash
|
||
docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }}: {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'
|
||
```
|
||
|
||
在输出内容中找到这两行:
|
||
|
||
复制
|
||
|
||
/docker-web-1: 172.19.0.5 : 3000
|
||
/docker-api-1: 172.19.0.7 : 5005
|
||
/docker-plugin_daemon-1 : 5002
|
||
|
||
记住后面的IP地址。然后打开你存放dify源代码的地方,打开dify/docker/nginx/conf.d,
|
||
|
||
* 将http://web:3000替换为http://172.19.0.5:3000,随后重启Nginx容器或者重载配置。
|
||
* 将http://api:5001替换为http://172.19.0.7:5005,
|
||
* 将[/docker-plugin_daemon-1](http://172.31.0.7:5002)
|
||
|
||
这些IP地址是_示例性_ 的,你必须执行命令获取你自己的IP地址,不要直接填入。 你可能在重新启动相关容器时需要再次根据IP进行配置。
|
||
|
||
|
||
/docker-api-1: 172.21.0.9172.24.0.5
|
||
/docker-web-1: 172.21.0.6
|
||
|
||
```bash
|
||
nginx -t
|
||
|
||
systemctl restart nginx
|
||
```
|
||
|
||
|
||
|
||
/docker-api-1: 172.28.0.4172.25.0.4
|
||
/docker-plugin_daemon-1: 172.28.0.10
|
||
/docker-db_postgres-1: 172.28.0.5
|
||
/docker-web-1: 172.28.0.2
|
||
|
||
|
||
---
|
||
|
||
|
||
下面的命令在centos上能执行,请帮我改为windows用的
|
||
|
||
```bash
|
||
curl -X POST 'https://aiplatform.wantsong.life/v1/completion-messages' \
|
||
--header 'Authorization: Bearer app-4UexIurvt65rzstThtqx0Fes' \
|
||
--header 'Content-Type: application/json' \
|
||
--data-raw '{
|
||
"inputs": {"prompt": "Hello, world!"},
|
||
"response_mode": "streaming",
|
||
"user": "sduser-bigdata-performance-pr"
|
||
}'
|
||
```
|
||
|
||
```bash
|
||
curl -X POST "https://aiplatform.wantsong.life/v1/completion-messages" --header "Authorization: Bearer app-4UexIurvt65rzstThtqx0Fes" --header "Content-Type: application/json" --data-raw "{\"inputs\": {\"prompt\": \"Hello, world!\"}, \"response_mode\": \"streaming\", \"user\": \"sduser-bigdata-performance-pr\"}"
|
||
``` |