OpenSearch in Docker Compose for a local Rails app

Hi,

I am building a basic Rails ap locally on my Mac. I have Rails installed locally and use Postgres and wish to use OpenSearch via Docker. My docker-compose file currently looks like this:

version: '3.7'
services:
    db:
        image: 'postgres:9.6'
        restart: always
        # env_file:
        #     - .env
        volumes:
            - db-volume:/var/lib/postgresql/data:rw,delegated
        ports:
            - '5432:5432'
        environment:
            POSTGRES_PASSWORD: example
    search:
        image: 'opensearchproject/opensearch:1.2.4'
        restart: always
        env_file:
            - .env
        volumes:
            - search-volume:/usr/share/opensearch/data:rw,delegated
        ports:
            - '9200:9200'
volumes:
    bundle-volume:
    yarn-volume:
    db-volume:
    search-volume:

When I run docker-compose up, I get an error that states

ERROR: [1] bootstrap checks failed
search_1 | [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
search_1 | ERROR: OpenSearch did not exit normally - check the logs at /usr/share/opensearch/logs/docker-cluster.log

How can I resolve this and allow basic usage via Searchkick for my Rails app?

Thanks,
Neil

Looks like you missing a few settings in the environment - I would follow the pattern in the docs for development on this page:

(you only need the opensearch-node1 object)

2 Likes

Thankyou so much. That seems to have done it!

1 Like