Please go easy on me here, My experience with ElasticSearch is pretty much solely with use of SearchKick and my own Rails app.
I have a Rails app which I have been running locally on my machine using SearchKick and ElasticSearch for quite some time now.
Recently I’ve been reading about how to convert my dev environment into a Dockerised form.
I have got my Rails app and it’s database working nicely but then I came to add Search back in and I noticed that OpenSearch has sort of replaced ElasticSearch (Yes yes, I know that’s not 100% correct but i’d prefer to use something open source if possible) so I thought i’d install that instead of ElasticSearch.
My Docker Compose file is below:
version: '3.7' services: app: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - .:/app - bundle-volume:/usr/local/bundle - yarn-volume:/app/node_modules ports: - "3000:3000" depends_on: - db - search db: image: 'postgres:9.6' env_file: - .env.development volumes: - db-volume:/var/lib/postgresql/data ports: - "5432:5432" # environment: # - POSTGRES_HOST_AUTH_METHOD=trust search: image: 'opensearchproject/opensearch' env_file: - .env.development volumes: - 'search-volume:/usr/share/opensearch/data' ports: - '9200:9200' volumes: bundle-volume: yarn-volume: db-volume: search-volume:
When I start the container and head to the Rails console to try and run
<Model>.reindex I get the following error:
Traceback (most recent call last):
1: from (irb):1
Faraday::ConnectionFailed (Failed to open TCP connection to localhost:9200 (Cannot assign requested address - connect(2) for “localhost” port 9200))
I have set an Environment var like so in my
Any ideas as to how I can get this working?