Skip to content

Suggest #6

@xiaotianyu666

Description

@xiaotianyu666

部署背景

部署 Dify 1.6 版本,数据库采用 AWS RDS 上的 PostgreSQL。在部署 plugin-daemon 时,出现数据库连接失败,导致 Pod 部署失败。

错误日志:

2025/07/18 07:51:52 init.go:91: [PANIC]failed to init dify plugin db: failed to connect to host=xxxxx user=dify database=postgres: server error (FATAL: no pg_hba.conf entry for host "xxxx", user "dify", database "postgres", no encryption (SQLSTATE 28000))

使用版本

  • Dify 版本: 1.6
  • 部署方式: Kubernetes

解决方案

根据官方 Issue #33 的建议,添加环境变量 DB_SSL_MODE="require" 可以解决该问题。经测试确认有效。

配置修改

需要在 plugin-daemon 的 Deployment 中添加以下环境变量配置:

containers:
  - name: plugin-daemon
    image: langgenius/dify-plugin-daemon:0.1.2-local
    envFrom:
      - configMapRef:
          name: dify-config
    env:
      - name: DB_SSL_MODE  # 必需添加此项,否则会因数据库连接失败而无法启动
        valueFrom:
          configMapKeyRef:
            name: dify-config
            key: DB_SSLMODE
      - name: DB_DATABASE
        valueFrom:
          configMapKeyRef:
            name: dify-config
            key: DB_PLUGIN_DATABASE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions