当前位置: 首页 > news >正文

潍坊网站建设定制seo顾问服务 品达优化

潍坊网站建设定制,seo顾问服务 品达优化,网站核验单怎么下载,wordpress手机浏览评论背景 前面我们以 docker compose 容器化的方式本地部署了 Dify 社区版,并快速体验了其聊天助手、工作量编排以及智能体(Agent)功能。不过后续实际生产环境使用时遇到了忘记密码、如何开启SSL以支持HTTPS、如何突破知识库文档上传的大小限制和…

背景

前面我们以 docker compose 容器化的方式本地部署了 Dify 社区版,并快速体验了其聊天助手、工作量编排以及智能体(Agent)功能。不过后续实际生产环境使用时遇到了忘记密码如何开启SSL以支持HTTPS如何突破知识库文档上传的大小限制和数量限制等问题。

2024-12-28-DifyArchitecture.jpg

遇到的问题

本地部署初始化后,忘记密码、密码错误如何重置?

这个问题官方文档里有写,在服务器上执行以下命令进行密码重置。

docker exec -it docker-api-1 flask reset-password

输入账户 email 以及两次新密码即可。

Note:一开始我并不知道官方文档提供了密码重置的方案,当时的第一想法是使用测试环境的密码覆盖生产环境的密码即可,便有了以下操作。
通过 docker-compose.yaml 以及 docker ps ,我们知道 Dify 用的是 PostgreSQL 数据库,不过默认没有开启远程访问,下面通过命令行来操作 PostgreSQL 数据库。

# 命令行连接PostgreSQL
[root@dify ~]# docker exec -it docker_db_1 /bin/bash
c84995ae10f8:/# psql -U postgres
psql (15.10)
Type "help" for help.# 列出所有数据库
postgres=# \lList of databasesName    |  Owner   | Encoding |  Collate   |   Ctype    | ICU Locale | Locale Provider |   Access privileges   
-----------+----------+----------+------------+------------+------------+-----------------+-----------------------dify      | postgres | UTF8     | en_US.utf8 | en_US.utf8 |            | libc            | postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 |            | libc            | template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 |            | libc            | =c/postgres          +|          |          |            |            |            |                 | postgres=CTc/postgrestemplate1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 |            | libc            | =c/postgres          +|          |          |            |            |            |                 | postgres=CTc/postgres
(4 rows)# 切换到dify数据库
postgres=# \c dify
You are now connected to database "dify" as user "postgres".# 查看所有数据表
dify=# \dList of relationsSchema |               Name                |   Type   |  Owner   
--------+-----------------------------------+----------+----------public | account_integrates                | table    | postgrespublic | accounts                          | table    | postgrespublic | alembic_version                   | table    | postgrespublic | api_based_extensions              | table    | postgrespublic | api_requests                      | table    | postgrespublic | api_tokens                        | table    | postgrespublic | app_annotation_hit_histories      | table    | postgrespublic | app_annotation_settings           | table    | postgrespublic | app_dataset_joins                 | table    | postgrespublic | app_model_configs                 | table    | postgrespublic | apps                              | table    | postgrespublic | celery_taskmeta                   | table    | postgrespublic | celery_tasksetmeta                | table    | postgrespublic | conversations                     | table    | postgrespublic | data_source_api_key_auth_bindings | table    | postgrespublic | data_source_oauth_bindings        | table    | postgrespublic | dataset_collection_bindings       | table    | postgrespublic | dataset_keyword_tables            | table    | postgrespublic | dataset_permissions               | table    | postgrespublic | dataset_process_rules             | table    | postgrespublic | dataset_queries                   | table    | postgrespublic | dataset_retriever_resources       | table    | postgrespublic | datasets                          | table    | postgrespublic | dify_setups                       | table    | postgrespublic | document_segments                 | table    | postgrespublic | documents                         | table    | postgrespublic | embeddings                        | table    | postgrespublic | end_users                         | table    | postgrespublic | external_knowledge_apis           | table    | postgrespublic | external_knowledge_bindings       | table    | postgrespublic | installed_apps                    | table    | postgrespublic | invitation_codes                  | table    | postgrespublic | invitation_codes_id_seq           | sequence | postgrespublic | load_balancing_model_configs      | table    | postgrespublic | message_agent_thoughts            | table    | postgrespublic | message_annotations               | table    | postgrespublic | message_chains                    | table    | postgrespublic | message_feedbacks                 | table    | postgrespublic | message_files                     | table    | postgrespublic | messages                          | table    | postgrespublic | operation_logs                    | table    | postgrespublic | pinned_conversations              | table    | postgrespublic | provider_model_settings           | table    | postgrespublic | provider_models                   | table    | postgrespublic | provider_orders                   | table    | postgrespublic | providers                         | table    | postgrespublic | recommended_apps                  | table    | postgrespublic | saved_messages                    | table    | postgrespublic | sites                             | table    | postgrespublic | tag_bindings                      | table    | postgrespublic | tags                              | table    | postgrespublic | task_id_sequence                  | sequence | postgrespublic | taskset_id_sequence               | sequence | postgrespublic | tenant_account_joins              | table    | postgrespublic | tenant_default_models             | table    | postgrespublic | tenant_preferred_model_providers  | table    | postgrespublic | tenants                           | table    | postgrespublic | tidb_auth_bindings                | table    | postgrespublic | tool_api_providers                | table    | postgrespublic | tool_builtin_providers            | table    | postgrespublic | tool_conversation_variables       | table    | postgrespublic | tool_files                        | table    | postgrespublic | tool_label_bindings               | table    | postgrespublic | tool_model_invokes                | table    | postgrespublic | tool_providers                    | table    | postgrespublic | tool_published_apps               | table    | postgrespublic | tool_workflow_providers           | table    | postgrespublic | trace_app_config                  | table    | postgrespublic | upload_files                      | table    | postgrespublic | whitelists                        | table    | postgrespublic | workflow_app_logs                 | table    | postgrespublic | workflow_conversation_variables   | table    | postgrespublic | workflow_node_executions          | table    | postgrespublic | workflow_runs                     | table    | postgrespublic | workflows                         | table    | postgres
(75 rows)# 查看账户表
dify=# \d accountsTable "public.accounts"Column       |            Type             | Collation | Nullable |           Default           
--------------------+-----------------------------+-----------+----------+-----------------------------id                 | uuid                        |           | not null | uuid_generate_v4()name               | character varying(255)      |           | not null | email              | character varying(255)      |           | not null | password           | character varying(255)      |           |          | password_salt      | character varying(255)      |           |          | avatar             | character varying(255)      |           |          | interface_language | character varying(255)      |           |          | interface_theme    | character varying(255)      |           |          | timezone           | character varying(255)      |           |          | last_login_at      | timestamp without time zone |           |          | last_login_ip      | character varying(255)      |           |          | status             | character varying(16)       |           | not null | 'active'::character varyinginitialized_at     | timestamp without time zone |           |          | created_at         | timestamp without time zone |           | not null | CURRENT_TIMESTAMP(0)updated_at         | timestamp without time zone |           | not null | CURRENT_TIMESTAMP(0)last_active_at     | timestamp without time zone |           | not null | CURRENT_TIMESTAMP(0)
Indexes:"account_pkey" PRIMARY KEY, btree (id)"account_email_idx" btree (email)# 查询所有用户记录
dify=# select * from accounts;id                  | name  |       email       |                                         password                                         |      password_salt       | avatar | interface_language | interface_theme |     timezone     |       last_login_at        | last_login_ip  | status |       initialized_at       |     created_at      |     updated_at      |      last_active_at      
--------------------------------------+-------+-------------------+------------------------------------------------------------------------------------------+--------------------------+--------+--------------------+-----------------+------------------+----------------------------+----------------+--------+----------------------------+---------------------+---------------------+--------------------------78837d37-83d0-4e21-88c0-25de52df8ee0 | Admin | you-guess@qq.com | OTYyYjZmNWFlMWI2MzIyZTU3ZWMyMjNmOGEzY2E0OTkwYmYxMzNmN2MzMTM2M2IyMzZlM2M0MDQyOTAyM2E1MQ== | 4bGygMJ7I7w6CLVXpEeRrA== |        | en-US              | light           | America/New_York | 2024-12-07 08:24:27.715579 | 192.168.27.200 | active | 2024-12-07 08:24:06.685263 | 2024-12-07 08:24:07 | 2024-12-07 08:24:07 | 2024-12-22 08:00:40.2632
(1 row)

可以看到密码密文盐值信息。接着使用一个已知密码的密文和盐值更新到 accounts 表;

从测试环境服务器上导出了 SQLInsert 语句。

pg_dump -d dify -U postgres --column-inserts -t accounts -f /opt/accounts.sql

UPDATE public.accounts SET password='YmFjYWMwYWFkNTU2MDlmMmViNTZhNTc3N2JjZDBjMDk4ZWVmNjRjYjA2MGU4MzQ0YTZjNzViNjVhYzAyMzZhYg==', password_salt='j13XCIHXI4N2AK4yIJuggQ==' WHERE id='78837d37-83d0-4e21-88c0-25de52df8ee0';

改了密码密文和盐值后,依然登不上?

经过上述密码密文盐值信息的替换后,还是没登上,不过错误信息是密码错误次数超限(默认锁定24小时)。这是因为当时忘记密码后,尝试了多次导致密码锁定。考虑到 Dify 用了 Redis ,而且一版这种密码次数错误限制我们也是通过 Redis 来实现,这里推测是 Redis 中有个用户被锁定的待超时时间的 Key 。直接打开 Dify 源码查看,果然~

2024-12-28-RedisKey.jpg

找见了原因,直接连上 Redis ,删除这个 Key 即可。

[root@dify opt]# docker exec -it docker_redis_1 sh
/data # redis-cli
127.0.0.1:6379> keys *
1) "refresh_token:7d177d5971609013a2c8a5634ce49de1d488332bb5961d8d69ce1a371a3abdeac65d9010df7a6f1e7c73508cbd6733e0c27e2235999ca593192919678ab688b4"
2) "reset_password:account:78837d37-83d0-4e21-88c0-25de52df8ee0"
3) "account_refresh_token:78837d37-83d0-4e21-88c0-25de52df8ee0"
4) "login_error_rate_limit:you-guess@qq.com"# 查看过期时间,大概还剩23个多小时。。
127.0.0.1:6379> ttl login_error_rate_limit:you-guess@qq.com
(integer) 85202# 删除这个Key
127.0.0.1:6379> del login_error_rate_limit:you-guess@qq.com
(integer) 1

之后即可成功登录~~

本地部署80端口被占用应该如何解决?

一般的服务器上会有其他服务占用 80 端口,这时需要修改 .env 文件,指定 Nginx 暴露的端口。

# 编辑.env文件
EXPOSE_NGINX_PORT=9080
EXPOSE_NGINX_SSL_PORT=9443

如何开启SSL以支持HTTPS?

  • 同样是编辑 .env 文件,配置 NGINX_HTTPS_ENABLED=true 开启 HTTPS
  • 此外,还需要将证书文件放到 dify-main/docker/nginx/ssl 目录下,记得命名为 dify.crtdify.key
  • 然后 docker-compose down 停止服务,最后启动服务 docker-compose up -d 生效。
NGINX_HTTPS_ENABLED=true

2024-12-28-SSL.jpg
Note:

  1. 具体SSL的配置是参考docker-compose.yaml里面的环境变量得到的;
  2. 关于如何自签证书,参考:自签SSL证书配置Nginx代理Vue+SpringBoot前后端分离服务。

如何解决知识库文档上传的大小限制和数量限制?

同样是编辑 .env 文件, Dify 知识库文档上传单个文档最大是 15MB ,总文档数量限制 100 个。本地部署的社区版本可根据需要调整修改该限制。

# 上传文件大小限制,默认15M。
UPLOAD_FILE_SIZE_LIMIT=50M# 每次上传文件数上限,默认5个。
UPLOAD_FILE_BATCH_LIMIT=10

小总结

本文主要介绍了 Dify 本地部署后遇到的几个常见问题及其解决方案:首先是忘记密码的处理,可以通过官方提供的 flask reset-password 命令重置,或者直接操作 PostgreSQL 数据库修改密码信息;其次是密码错误次数超限导致账户锁定的问题,可以通过删除 Redis 中对应的限制 Key 来解决;再次是端口占用和 HTTPS 配置问题,可以通过修改 .env 文件中的 EXPOSE_NGINX_PORTNGINX_HTTPS_ENABLED 等配置来解决;最后介绍了如何通过调整 .env 文件中的 UPLOAD_FILE_SIZE_LIMITUPLOAD_FILE_BATCH_LIMIT 参数来突破知识库文档上传的大小限制和数量限制。

Reference

  • https://docs.dify.ai/zh-hans

If you have any questions or any bugs are found, please feel free to contact me.

Your comments and suggestions are welcome!


文章转载自:
http://protandrous.spbp.cn
http://hood.spbp.cn
http://heathenize.spbp.cn
http://huntaway.spbp.cn
http://eligibly.spbp.cn
http://prad.spbp.cn
http://retinoid.spbp.cn
http://lux.spbp.cn
http://longsome.spbp.cn
http://bulletin.spbp.cn
http://zooecology.spbp.cn
http://biospeleology.spbp.cn
http://tanrec.spbp.cn
http://ecafe.spbp.cn
http://polavision.spbp.cn
http://succade.spbp.cn
http://guianese.spbp.cn
http://gadzooks.spbp.cn
http://estafette.spbp.cn
http://kindling.spbp.cn
http://surcease.spbp.cn
http://ultrasonic.spbp.cn
http://extraordinaire.spbp.cn
http://modifier.spbp.cn
http://chloromycetin.spbp.cn
http://kaleidophone.spbp.cn
http://probusing.spbp.cn
http://uricase.spbp.cn
http://vermian.spbp.cn
http://bebeeru.spbp.cn
http://rustle.spbp.cn
http://sinal.spbp.cn
http://gynandrous.spbp.cn
http://andamanese.spbp.cn
http://frostbitten.spbp.cn
http://veloce.spbp.cn
http://spiffing.spbp.cn
http://jurisprudential.spbp.cn
http://productively.spbp.cn
http://deformed.spbp.cn
http://jura.spbp.cn
http://catechu.spbp.cn
http://achlamydeous.spbp.cn
http://subject.spbp.cn
http://watchmaker.spbp.cn
http://resolutive.spbp.cn
http://seashell.spbp.cn
http://myotic.spbp.cn
http://picaresque.spbp.cn
http://unboot.spbp.cn
http://potboil.spbp.cn
http://siderolite.spbp.cn
http://gripsack.spbp.cn
http://despairingly.spbp.cn
http://jsp.spbp.cn
http://grinningly.spbp.cn
http://pedes.spbp.cn
http://tanu.spbp.cn
http://worrier.spbp.cn
http://seamster.spbp.cn
http://energy.spbp.cn
http://subgum.spbp.cn
http://bailie.spbp.cn
http://surprisedly.spbp.cn
http://consanguine.spbp.cn
http://success.spbp.cn
http://sulfamerazine.spbp.cn
http://inveteracy.spbp.cn
http://expiratory.spbp.cn
http://vincula.spbp.cn
http://mesopeak.spbp.cn
http://ussb.spbp.cn
http://thurifer.spbp.cn
http://santeria.spbp.cn
http://domelight.spbp.cn
http://retrochoir.spbp.cn
http://fraenum.spbp.cn
http://tetraonid.spbp.cn
http://thermochemistry.spbp.cn
http://dollish.spbp.cn
http://vittoria.spbp.cn
http://resedaceous.spbp.cn
http://moschate.spbp.cn
http://fasciolar.spbp.cn
http://javastation.spbp.cn
http://forehoof.spbp.cn
http://leafcutter.spbp.cn
http://apothecary.spbp.cn
http://perplexity.spbp.cn
http://conchiferous.spbp.cn
http://rode.spbp.cn
http://inbeing.spbp.cn
http://yecchy.spbp.cn
http://declination.spbp.cn
http://closure.spbp.cn
http://strikebound.spbp.cn
http://megavolt.spbp.cn
http://curviform.spbp.cn
http://coming.spbp.cn
http://waldenses.spbp.cn
http://www.hrbkazy.com/news/80452.html

相关文章:

  • 整形医院网站模板百度seo效果怎么样
  • 电商基础入门教程什么叫优化关键词
  • 佛山专业做淘宝网站推广百度网站推广排名
  • 网站功能设计有哪些要求关键词优化
  • 外贸网络营销的主动营销有哪些seo高端培训
  • 网站开发视频教程百度网盘高端企业网站定制公司
  • 建设外贸商城网站国内营销推广渠道
  • 区域销售网站什么做网络推广外包公司干什么的
  • 涉县移动网站建设公司在线咨询 1 网站宣传
  • 企业网站建设哪家便宜b站推广入口
  • 长沙 做营销型网站的公司产品推广软件有哪些
  • 外贸网站推广如何做网络营销推广合作
  • 英国做电商网站seo学徒招聘
  • 西安网站制作排名南昌seo网站排名
  • 怎么做网上直营店网站网站优化关键词
  • dw做网站背景音乐网站开发流程
  • p2p网站建设框架沧浪seo网站优化软件
  • 现在网站主怎么做淘宝客爱站
  • 新疆住房和城乡建设局网站torrentkitty磁力天堂
  • 免费的ps软件合肥seo排名优化
  • 网站开发服务合同范本可口可乐营销策划方案
  • php做网站难么百度一下首页网页百度
  • 上海网站建设找哪家指数基金定投怎么买
  • asp制作动态网站开发重庆网站建设
  • 网站如何做跳板如何制作一个简单的网页
  • 游仙建设局官方网站哈尔滨优化推广公司
  • 欧美网站模板下载品牌seo培训咨询
  • 免费网站空间怎么做emlog友情链接代码
  • 合肥网站设计建设链接购买
  • 聊城网站制作价格网络建站优化科技