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

Automatically created SOLR core with docker-compose.yml #16

Open
tic0uk opened this issue May 16, 2021 · 1 comment
Open

Automatically created SOLR core with docker-compose.yml #16

tic0uk opened this issue May 16, 2021 · 1 comment

Comments

@tic0uk
Copy link

tic0uk commented May 16, 2021

Hi,

I had a question about Solr and the core setup. All works well when we use the Wodby control panel to set up Varnish and it auto creates a core called 'default' which is great.

The issue we're having is on our local deployments which we're trying to automate. We can create the container for Solr using wodby/solr with no issues using a docker-compose.yml file, however, I've reached a road block with trying to automate the core creation. I’ve tried a variation of things for quite some time with this so far and no luck. If we login with a shell and run

'make create core=default -f /usr/local/bin/actions.mk'

then it works, but we ideally need this to happen when the container is built rather than manually doing it and I can't seem to get this into the docker-compose.yml which we use.

I've seen that Wodby Solr needs to spin up with entrypoint.sh, followed by command solr-foreground. If I try to make the core before solr-foreground fails as solr needs to be running.

One of the main ways I’ve tried to work around this is by adding in my docker-compose.yml;

command: bash -c “solr-foreground && make create core=default -f /usr/local/bin/actions.mk”

This should work but the 'make create' command is ignored. I think this is because 'solr-foreground' runs solr-fg “$@” in the script. I'm thinking that as it’s expecting arguments it ignores anything else I put afterwards including the '&& make create..' command as it's reading it as an argument. I’ve tested this by attempting to create a file instead of running the make create. Trying to create the file before I run the solr-foreground.sh works.

Everything I’ve read elsewhere says to use a command usefully called ‘precreate-core’ beforehand, but it’s directory is hardcoded set to create the file in /var/solr/data, however, your version uses /opt/solr/server/solr. It does note in the make action.mk file that "We don't use solr CLI because it does not create configs out of config set", which I'm wondering this is the reason.

The closest I’ve got to things working is;

command: bash -c "precreate-core default; solr-foreground -s /var/solr/data"

This does creates the core and seems to link it up correctly, but using the above gives me an error using the normal search on the site SOLR on my local.

Do you know any way that I can get the core automatically created as part of the container build using a docker-compose.yml file? I'm hoping that as you've found a way for your Wodby control panel to automate building the core, that you may just know a command I could try in there that we could use.

Thanks in advance,
Tim

@csandanov
Copy link
Member

Whatever is the solution to your problem it is sure should be outside of the image because you somehow has to track when a solr server has started inside a container and only then create a core. In case of Wodby kubernetes does this job with the healthiness checks.

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