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

Configure Solr Collection supports 9.3? #1

Open
klpatil opened this issue Aug 6, 2020 · 4 comments
Open

Configure Solr Collection supports 9.3? #1

klpatil opened this issue Aug 6, 2020 · 4 comments

Comments

@klpatil
Copy link

klpatil commented Aug 6, 2020

Hello Jeremy,

Thanks for sharing your scripts - Great work!

In my past projects - I've always used SearchStax and I use a plugin to create Cores: https://github.com/searchstax/searchstax-sitecore-plugin

I'm planning to use the following script to configure Solr Cloud Collections for Sitecore 9.3 + SXA - (Solr Cloud is already configured by other departments)

SolrCollections.ps1

Here I noticed zip variable has binary value -- This is for which version of Sitecore?

Also, as per SearchStax plugin - There are two seperate configs for configuring xp and xdb collections. How do you handle that?

Any help will be greatly appreciated!

Kiran

@jermdavis
Copy link
Owner

I've not updated this for V9.3 - Sorry - I've not been working on anything that required it, so it had fallen off my tasklist... But I do have some work in the future that may require a 9.3/10 version - And I'd been worrying about making this work with Docker containers a bit too.

The binary value in the script is a base-64 encoded zip file - which holds the two Solr schema zip files that you need to create collections for Sitecore. SolrCloud's API requires you upload your schema config as zip files, and it puts that data into the right places on all your nodes. The data was hard-coded in this script because that was the easiest way to ship it - but it's not difficult to replace.

You can extract that blob of data to disk by calling Write-EmbeddedFile and passing in the $zip variable and a disk path to save the data to. That'll get you the zip file back, so you can explore it and see how stuff is structured. The Expand-Base64CoreConfig function does the hard work of extracting everything at runtime, if that helps make sense of what's happening.

The process I'd used to create this blob of data is a bit complex, but not too hard:

  • Find a copy of ordinary Solr that the v9.3 SIF script for an XP0-Developer instance had installed. (Doesn't have to be that topology - but I figure that's the one you're most likely to have access to anyway)
  • Navigate down to the folder where it keeps its cores and pick one "sitecore content" core and one "xdb data" core. Those two cores will have the two different Solr Schemas we need to prepare.
  • Copy those two folders to a temp folder, and delete all the Solr data from them - leaving just the "conf" folder.
  • For each of those folders, make a zip file that contains just the relevant "conf" folder. They need to be named Sitecore.zip and "xDB.zip" as per the two lines of code that try to extract them.
  • Zip those two files up in a new archive. Name for that doesn't matter.
  • Then use a bit of PowerShell that calls Convert.ToBase64String() to make that zip file into a new blob of data to paste into the $zip string in the script file

I should probably have written some script to automate that... ;-)

The other thing to consider is if SXA or V9.3 require any extra collections - not sure about that off the top of my head, but it might be an issue. That's fairly easy to change though, as they're described in the code. That config could probably do with abstracting out - but I never got around to making that change...

That make sense?

@klpatil
Copy link
Author

klpatil commented Aug 6, 2020

That makes perfect sense -- I will do it -- and If everything works -- will create PR here.

Thank you so much for outlining detailed steps - appreciate!

@klpatil
Copy link
Author

klpatil commented Aug 6, 2020

Quick update : I was able to make this work!

I added Configs folder where we can keep final config files for various versions and added function which does MAGIC!

$FilePath = ".\SolrCloud-Helpers\Configs\solr-8.1-9.3.zip"
$File = [System.IO.File]::ReadAllBytes($FilePath);

$Base64String = [System.Convert]::ToBase64String($File);

$zip = $Base64String

Noticed few things:

- Setup-OpenJDK.ps1 : This was pointing to some scripting-helpers [might be old folder name] changed it to : Import-Module ".\SolrCloud-Helpers" -DisableNameChecking

I need to do a few cleanup activities and try this couple of times. Before I create PR. But in case you start working on this before -- Let me know will share my learnings.

Thanks again,
Kiran

@jermdavis
Copy link
Owner

If you're adjusting it to have a set of configs in a folder, you probably don't need any of the Base64 business? That was there so I could plug the zip directly into the PowerShell and avoid shippping extra files - but if the files get added, you can just reference them directly I think? Remove a bit of complexity?

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