Connecting weaviate with langflow across docker containers

题意:在Docker容器之间连接Weaviate与Langflow

问题背景:

I am trying to build a local RAG application using Langflow. For my vectore store, I want to use a local Weaviate instance, hosted in a separate docker container on the same network. Building the Weaviate component in Langflow fails, and throws an error:

Error Building Component

    Error building Component Weaviate: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /v1/.well-known/openid-configuration (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb2a2db9fa0>: Failed to establish a new connection: [Errno 111] Connection refused'))

My setup: Docker for Desktop v4.31.1 on Windows Compose file:

version: "3.9"
name: proto_rag

services:
  langflow:
    image: langflowai/langflow:1.0-alpha
    ports:
      - "7860:7860"
    depends_on:
      - postgres
    environment:
      - LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow
      # This variable defines where the logs, file storage, monitor data and secret keys are stored.
      - LANGFLOW_CONFIG_DIR=app/langflow
    volumes:
      - langflow-data:/app/langflow

  postgres:
    image: postgres:16
    environment:
      POSTGRES_USER: langflow
      POSTGRES_PASSWORD: langflow
      POSTGRES_DB: langflow
    ports:
      - "5432:5432"
    volumes:
      - langflow-postgres:/var/lib/postgresql/data

  weaviate:
    command:
    - --host
    - 0.0.0.0
    - --port
    - '8080'
    - --scheme
    - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.25.4
    ports:
    - 8080:8080
    - 50051:50051
    volumes:
    - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    environment:    
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      DISABLE_TELEMETRY: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-ollama'
      ENABLE_MODULES: 'text2vec-ollama'
      CLUSTER_HOSTNAME: 'node1'  

  ollama:
    volumes:
     - ollama:/root/.ollama
    ports:
     - 11434:11434
    container_name: ollama
    image: ollama/ollama

volumes:
  langflow-postgres:
  langflow-data:
  ollama:
  weaviate_data:

My weaviate component in Langflow calls http://localhost:8080 and has the variable "index name" set to "vector_store".

Connecting to ollama on localhost works, so it doesn't seem to be a network problem. However since AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED is set true I can't see a reason why weaviate would refuse the connection.

I tried setting up users and API keys in the compose file and using the key in the langflow component, this had no effect.

[...]
      AUTHENTICATION_APIKEY_ENABLED: 'true'
      AUTHENTICATION_APIKEY_ALLOWED_KEYS: 'key206339812'
      AUTHENTICATION_APIKEY_USERS: 'user206339812'
[...]

I also tried raising the Query limit, which also had no effect.

      QUERY_DEFAULTS_LIMIT: 1000

This thread suggests to use the service/container name for reference instead of localhost, this failed aswell.

问题解决:

Indeed, your error message is consistent with that thread's one. Looks like your Langflow is trying to connect to weaviate at http://localhost:8080.

Considering you are using docker, this is not the place where Langflow will find Weaviate, but http://weaviate:8080

I have used your docker-compose, and was able to ingest data using this simple flow in Langflow:

Let me know if this helps.

  • 15
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

营赢盈英

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值