参考文献

上传知识库时,使用bge-m3,报错Vector database connection error

  • 具体指无法连接到weaviate

  • 使用官网的版本

1
2
3
4
# 假设当前最新版本为 0.15.3
git clone https://github.com/langgenius/dify.git --branch 0.15.3

docker-compose up -d
  • 排查下来docker-compose.yaml中的weaviate没有启动,以及服务器docker-compose版本

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    # The Weaviate vector store.
    weaviate:
    image: semitechnologies/weaviate:1.19.0
    profiles:
    - ''
    - weaviate
    restart: always
    volumes:
    # Mount the Weaviate data directory to the con tainer.
    - ./volumes/weaviate:/var/lib/weaviate
    environment:
    # The Weaviate configurations
    # You can refer to the [Weaviate](https://weaviate.io/developers/weaviate/config-refs/env-vars) documentation for more information.
    PERSISTENCE_DATA_PATH: ${WEAVIATE_PERSISTENCE_DATA_PATH:-/var/lib/weaviate}
    QUERY_DEFAULTS_LIMIT: ${WEAVIATE_QUERY_DEFAULTS_LIMIT:-25}
    AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: ${WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED:-false}
    DEFAULT_VECTORIZER_MODULE: ${WEAVIATE_DEFAULT_VECTORIZER_MODULE:-none}
    CLUSTER_HOSTNAME: ${WEAVIATE_CLUSTER_HOSTNAME:-node1}
    AUTHENTICATION_APIKEY_ENABLED: ${WEAVIATE_AUTHENTICATION_APIKEY_ENABLED:-true}
    AUTHENTICATION_APIKEY_ALLOWED_KEYS: ${WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS:-WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih}
    AUTHENTICATION_APIKEY_USERS: ${WEAVIATE_AUTHENTICATION_APIKEY_USERS:-hello@dify.ai}
    AUTHORIZATION_ADMINLIST_ENABLED: ${WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED:-true}
    AUTHORIZATION_ADMINLIST_USERS: ${WEAVIATE_AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai}
    1
    2
    $docker-compose version
    Docker Compose version v2.2.2
  • 解决办法指定profile

    1
    docker-compose --profile weaviate up -d

配置域名开启HTTPS

  • 主要是修改配置文件(.env)

  • 先修改NGINX_PORTNGINX_SSL_PORT防止默认端口与其他端口冲突

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # ------------------------------
    # Environment Variables for Nginx reverse proxy
    # ------------------------------
    # HTTP port
    NGINX_PORT=10086
    # SSL settings are only applied when HTTPS_ENABLED is true
    NGINX_SSL_PORT=10087

    # ------------------------------
    # Docker Compose Service Expose Host Port Configurations
    # ------------------------------
    EXPOSE_NGINX_PORT=10086
    EXPOSE_NGINX_SSL_PORT=10087
  • 然后使用docker-compose -f docker-compose.yaml up -d先将服务启动起来

  • 成功启动后,继续修改配置文件(.env)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    # 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=fullchain.pem
    NGINX_SSL_CERT_KEY_FILENAME=privkey.pem

    # Set true to accept requests for /.well-known/acme-challenge/
    NGINX_ENABLE_CERTBOT_CHALLENGE=true

    # ------------------------------
    # Certbot Configuration
    # ------------------------------

    # Email address (required to get certificates from Let's Encrypt)
    CERTBOT_EMAIL=your_email@example.com

    # Domain name
    CERTBOT_DOMAIN=your_domain.com
  • 然后使用docker-compose --profile certbot up --force-recreate -d启动certbot服务

  • 然后使用docker exec -it cerbot /bin/sh /update-cret.sh 来申请证书

  • 修改配置文件(.env)

    1
    2
    # 开启NGINX HTTPS
    NGINX_HTTPS_ENABLED=true
  • 然后使用``docker-compose --profile certbot up --force-recreate -d --no-deps nginx重建一下nginx`服务