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

Add solr core reload/optimize #215

Closed
wants to merge 2 commits into from
Closed

Conversation

DonRichards
Copy link
Member

The make solr-cores command "Creates solr-cores according to the environment variables.". This new command solr-reload-cores reloads the solr core with current live configurations and then optimizes it. This allows people to reload and optimize from the terminal quickly.

To test

Before running
Before

Then run make solr-reload-cores

After running command
After running

$ make solr-reload-cores 
{
  "responseHeader":{
    "status":0,
    "QTime":243}}
{
  "responseHeader":{
    "status":0,
    "QTime":2}}
Can be verified at http://172.22.0.3:8983/solr/#/~cores/ISLANDORA

@ysuarez
Copy link
Contributor

ysuarez commented Apr 6, 2022

@DonRichards right now I am comfortable with running make demo and make local, but to test this I may need to load up some minimal content to help confirm this PR work correctly. Any tips on how to get some minimal content added to make sure I am performing a good enough test of this PR.

Off the top of my head I am thinking I can manually add some images, then add some minimal metadata. Run some searches. Then run make solr-reload-cores and try some searches again?

@DonRichards
Copy link
Member Author

@ysuarez Adding anything at all (Islandora content) should be enough to indicate the core is not current. To see the Solr dashboard you'll need to "expose" it. Set it to true in the env file. Here's how to pull in changes to the .env file. To see the Solr dashboard go to
http://islandora.traefik.me:8983
If you get an error going to the page it's important to verify "http://..." and is not "https://...". Solr dashboard is not secure so there's no "s" in the protocol and most browsers will try to redirect you to the HTTPS equivalent even when you specifically asked for HTTP.

@DonRichards
Copy link
Member Author

@ysuarez Any luck testing this?

@ysuarez
Copy link
Contributor

ysuarez commented Apr 13, 2022

I am currently testing this and sharing results with Don as I write this. I will provide updates when I have results.

@ysuarez
Copy link
Contributor

ysuarez commented Apr 13, 2022

Here is how the testing went.

I first ran make local but solr was not installed properly, no cores were set up..

I then switched to running make demo

I first visited http://islandora.traefik.me:8983/solr/#/~cores/ISLANDORA and I saw that the "current value" was set to red forbidden icon, i.e. not current.

(regretfully I forgot to take a screenshot)

Then I created 2 repository nodes, but there was a Drupal writing permission error, so I could not ingest images. I then added some additional metadata to the 2 nodes from earlier.

I then visited http://islandora.traefik.me:8983/solr/#/~cores/ISLANDORA and the 'current' value had a green check mark(!). I may be misunderstanding the PR, but I expected a red icon at this point.

before runing command but after node update - Screen Shot 2022-04-13 at , Apr 13, 2022 - 12 15 18 PM

I then finally ran make solr-cores for the first time and then again visited http://islandora.traefik.me:8983/solr/#/~cores/ISLANDORA and "current value" was set to red forbidden icon, i.e. not current.

after running make solr--Screen Shot 2022-04-13 at , Apr 13, 2022 - 12 14 23 PM

As a test (without making any node changes) I ran make solr-cores a second time, and then again visited http://islandora.traefik.me:8983/solr/#/~cores/ISLANDORA and "current value" was set to red forbidden icon, i.e. not current.

after running make solr 2nd time - Screen Shot 2022-04-13 at , Apr 13, 2022 - 12 20 49 PM

I hope this helps.

@DonRichards
Copy link
Member Author

DonRichards commented Apr 20, 2022

@ysuarez What was the output of running make solr-reload-cores

@ysuarez
Copy link
Contributor

ysuarez commented Apr 20, 2022

Don, below is the only output I got today after I ran make solr-reload-cores...

make solr-reload-cores
curl: (7) Failed to connect to 172.24.0.11 port 8983: Operation timed out
make: *** [Makefile:160: solr-reload-cores] Error 7

For the record, my test instance was built by running make demo (since make local on this branch does not create a valid solr core), with an edited .env file that had EXPOSE_SOLR=true and after I had create a simple repository item node.

@DonRichards
Copy link
Member Author

@ysuarez That brings up a good point. This PR should check if Solr is exposed. Otherwise, it won't work.

@ysuarez
Copy link
Contributor

ysuarez commented Jun 15, 2022

@DonRichards I just ran make local and I noticed that there were no cores listed at

http://islandora.traefik.me:8983/solr/#/

image

I will now try with make demo

BTW the "tag" value is:
TAG=1.0.0-alpha-11

@ysuarez
Copy link
Contributor

ysuarez commented Jun 15, 2022

I got further when using make demo because it created the ISLANDORA core, but I got an error in line 160 in the make file.

Here is the error:

curl: (52) Empty reply from server
make: *** [Makefile:160: solr-reload-cores] Error 52

Here is line 160 in context:

isle-dc/Makefile

Lines 156 to 163 in b3349e9

# Reloads solr-cores with current live configurations and then optimizes it. This assumes the solr-core is named ISLANDORA.
.PHONY: solr-reload-cores
.SILENT: solr-reload-cores
solr-reload-cores:
curl $(shell grep -Fxq "EXPOSE_SOLR=true" .env && echo "http://$(shell docker inspect -f "{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $(shell docker ps --format "{{.Names}}" | grep solr)):8983/solr/admin/cores?action=RELOAD\&core=ISLANDORA")
curl $(shell grep -Fxq "EXPOSE_SOLR=true" .env && echo "http://$(shell docker inspect -f "{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $(shell docker ps --format "{{.Names}}" | grep solr)):8983/solr/ISLANDORA/update?optimize=true")
echo "Can be verified at http://$(shell docker inspect -f "{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}" $(shell docker ps --format "{{.Names}}" | grep solr)):8983/solr/#/~cores/ISLANDORA"

I wonder if this is a macOS issue with the use of shell, because I thought it had come up before?

@ysuarez
Copy link
Contributor

ysuarez commented Jun 15, 2022

FYI, looks like I can merge this PR, but I don't think I should be allowed to merge code.

Never mind, I thought this was another PR that needed someone to merge.

@DonRichards DonRichards closed this Feb 8, 2023
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

Successfully merging this pull request may close these issues.

2 participants