Unable to deploy python app with weaviate using a single docker-compose.yml file

Hi,

I have added my python service in the docker-compose.yml file generated from weaviate site. When i run docker-compose up command I am expecting to run my python scripts which creates schema in weaviate and adds data to it. However, even though the weaviate image is running on locahost:8080 after executing docker-compose up, the python script is failing with below error:

weaviate.exceptions.WeaviateStartUpError: Weaviate did not start up in 5 seconds. Either the Weaviate URL http://localhost:8080 is wrong or Weaviate did not start up in the interval given in ‘startup_period’

My docker-compose.yml file is as below:
version: ‘3.4’
services:
weaviate:
image: semitechnologies/weaviate:1.19.6
restart: on-failure:0
ports:
- “8080:8080”
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: ‘true’
PERSISTENCE_DATA_PATH: “./data”
DEFAULT_VECTORIZER_MODULE: text2vec-transformers
ENABLE_MODULES: ‘text2vec-transformers, text2vec-openai,generative-openai’
TRANSFORMERS_INFERENCE_API: http://t2v-transformers:8080
CLUSTER_HOSTNAME: ‘node1’
t2v-transformers:
image: semitechnologies/transformers-inference:sentence-transformers-paraphrase-MiniLM-L6-v2
environment:
ENABLE_CUDA: 0 # set to 1 to enable
# NVIDIA_VISIBLE_DEVICES: all # enable if running with CUDA
web:
build: .
command: python src/createschema.py && adddata.py && python src/test.py"
ports:
- ‘5000:5000’
depends_on:
- weaviate
- t2v-transformers

Please let me know if anything is missing in my configuration.
Thanks in advance.

1 Like

I’m having the same issue. I’ve tried to add a healthcheck step in the docker-compose file which didn’t help either. Does anyone know how to solve it?

Hi!

I believe the issue is that if your script is running inside a docker in a docker-compose, it should point to weaviate at http://weaviate:8080 and not at localhost, as it is running on a different host.

Let me know if this helps :slight_smile:

By the way, this is a great example on how you can do it:

Can you also send you Dockerfile once to have a look and once tell what url are you mentioning in chreateschema.py & adddata.py while initializing the weaviate client.

Hi! The entire is here:

@Sriparna In your createschema.py, adddata.py or test.py, if you have anywhere initialized the weaviate client and given localhost or any other url just change it to:

http://weaviate:8080

I did the same in mine and worked for me.

1 Like