Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended approach for loading a schema and configset using the operator #740

Open
jamesla opened this issue Dec 19, 2024 · 1 comment

Comments

@jamesla
Copy link

jamesla commented Dec 19, 2024

I'm struggling to load a schema and a configset using the operator.

In my docker-compose I do it like this:

  config-loader:
    image: alpine/curl:latest
    container_name: solr-init
    volumes:
      - ./solrconfig.xml:/solrconfig.xml
      - ./managed-schema.xml:/managed-schema.xml
    depends_on:
      solr-cloud:
        condition: service_healthy
    entrypoint: >
      /bin/sh -c '
      curl -s -X PUT --header "Content-Type:application/octet-stream" --data-binary @solrconfig.xml "http://solr-cloud:8983/api/cluster/configs/llm_papers_configset/solrconfig.xml";
      curl -X PUT --header "Content-Type:application/octet-stream" --data-binary @managed-schema.xml "http://solr-cloud:8983/api/cluster/configs/llm_papers_configset/managed-schema.xml";
      curl "solr-cloud:8983/solr/admin/collections?action=CREATE&name=llm_papers&numShards=1&replicationFactor=1&collection.configName=llm_papers_configset&wt=json&zkHost=zookeeper:2181";
      '

I have tried using a sidecarContainer however I feel like that is the wrong approach since solrcloud api needs to be ready in order to receive the requests which creates a race condition.

I've also read through the CRD options but I can't find anything related to configsets or schemas.

What is the recommended way to approach this using the operator?

@janhoy
Copy link
Contributor

janhoy commented Dec 20, 2024

Hi. I normally prefer letting the Application that will index content to Solr own also the configSet and collection. Thus when your application first talks to Solr, it will check if Collection X and ConfigSet Y exists, if not it will upload and create.

If you for some reason want a pre-canned config, I have had success using helm post-install hooks, in which you can run a script that waits for ready state and then does whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants