Weaviate and t2v on an aws instance

Description

so i deployed my app which works fine on my local computer but when i deployed it on an aws instance using docker compose , some services aren’t really that linked to each other. I would like to know what should i change in my compose file and my code to make it work.

Server Setup Information

  flask-app:
    image: #private docker registry here
    ports:
      - "5000:5000"
    volumes:
      - "volume-flaskapi:/usr/src/app"
    environment:
      FLASK_APP: app.py
      FLASK_ENV: development
    command: bash -c "python -m venv venv && source venv/bin/activate && pip install --no-cache-dir -r requirements.txt && flask run --host=0.0.0.0 --reload"
    depends_on:
      weaviate:
        condition: service_healthy
  weaviate:
    command:
      - --host
      - 0.0.0.0
      - --port
      - '8080'
      - --scheme
      - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.24.18
    ports:
      - 8080:8080
      - 50051:50051
    volumes:
    - weaviate_data:/var/lib/weaviate
    environment:
      TRANSFORMERS_INFERENCE_API: 'http://t2v-transformers:8080'
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-transformers'
      ENABLE_MODULES: 'text2vec-transformers'
      CLUSTER_HOSTNAME: 'node1'
    healthcheck:
      test: ["CMD", "nc", "-z", "localhost", "8080"]
      interval: 20s
      timeout: 5s
      retries: 5
      start_period: 30s

  t2v-transformers:
    image: cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-paraphrase-multilingual-MiniLM-L12-v2
    environment:
      ENABLE_CUDA: '0'

connection to weaviate in flask app
client = weaviate.connect_to_local(host="weaviate")

hi @Hamza_Rezgui !!

in your scenario, you should avoid using connect_to_local, and use connect_to_custom instead.

or if using connect_to_local, also provide grpc_host as “weaviate”

I believe this will work for you:

client = weaviate.connect_to_custom(
    http_host="weaviate",
    http_port=8080,
    http_secure=False,
    grpc_host="weaviate",
    grpc_port= 50051,
    grpc_secure=False,
)

print(client.is_ready())

Let me know if this helps!

THanks!