docksal / service-solr

Apache Solr service images for Docksal
https://docksal.io
MIT License
0 stars 8 forks source link

ARM64 support? #22

Open dshumakerUT opened 2 years ago

dshumakerUT commented 2 years ago

Has anyone tried to integrate ARM64 support for the solr service?

https://hub.docker.com/r/amd64/solr/

danshumaker commented 1 year ago

#1421

danshumaker commented 1 year ago

Was able to get arm64v8 working with native (non-docksal) images, albeit I had to modify the search_api_solr module to do so:

https://github.com/mkalkbrenner/search_api_solr/pull/80

loopy3025 commented 1 year ago

Well, the good news is that SOLR_IMAGE='solr:8.11.2' does fire up a server on our M1 machine without complaints.

The bad news is that the docksal "user-owned" index does not get created during fin start.

Are we going to have to create scripts that generate these on our own and add them to, like, a fin init command? Are there examples of this? I am quite out of my depth in this regard, I must admit.

We're also deeply concerned about the differences between SOLR 8 locally and SOLR 7 upstream. We don't have the option for solr 8 upstream currently.

I did try going into solr at solr.mysite.docksal.site and create the user-owned core myself. I get:

Error CREATEing SolrCore 'user-owned': Unable to create core [user-owned] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/var/solr/data/user-owned'

which I guess means that the docksal-preinit script eithter never fires during fin start or the file copy fails for some reason.

danshumaker commented 1 year ago

I use this bash to create cores with

#!/bin/bash -xv
#
# THE PARAMETERS ARE HARD CODED HERE BUT YOU WILL NEED TO ADJUST THEM PER PROJECT
#
# -c is the name of the core to create. THIS HAS TO MATCH YOUR CORE NAME that is already set in the drupal admin UI.
#    We are assuming you setup solr search before converting it to docksal. If you are creating it anew then you can
#    call the core whatever you want.
#
# -d is the directory to search for the config set templates to use.  This CAN (but does not have to be) checked into the
#    git repository.  Sometimes it IS checked into the repository in order to help the developers get started.  DO NOT use
#    a config set directory from a version of solr that is different than the version for which it was generated.  This
#    important fact is why we put the solr version in the directory name
#
# -n is the name of the server that you may or may not have set in the drupal admin UI.  Whichever comes first (this script or
#    drupal admin setup) doesn't matter, but they do need to match because that machine name is used by the config export
#    process and is store on disk
#

docker exec -it $(docker ps --filter "name=solr" --format '{{ .ID }}') solr create_core -c solr-core-name -d solr-config-set-directory-name -n solr-drupal-server-name
lmakarov commented 1 year ago

Well, the good news is that SOLR_IMAGE='solr:8.11.2' does fire up a server on our M1 machine without complaints.

The bad news is that the docksal "user-owned" index does not get created during fin start.

@loopy3025 solr:8.11.2 is an official stock Solr image without extra logic applied on top (this repo), which made the whole integration with Drupal's Search API Solr module a breeze.

Unfortunately, there is no bandwidth right now between maintainers to work on the updated Docksal Solr images. Going with stock images + documented or automated configuration steps will likely be the way forward.

Either in a form of Docksal Solr docs or the updated docksal/add-ons/solr addon-on (or both). PRs are always welcome.

I use this bash to create cores with

@danshumaker thanks for sharing this. Do you also have to patch the search_api_module as you mentioned earlier?

danshumaker commented 1 year ago

The patch had issues but is actually not necessary because the https://hub.docker.com/r/amd64/solr/ repo works.

If the bash script above is .docksal/commands/solr-create-core then these comments in my settings.local.php should work for solr 8.11+ . I have not tried solr 9.

/**
 * Solr Setup:
 *
 *  - Uncomment the lines below starting at config:
 *
 *  - Create a config set via drush if you do not have one already.
 *    `drush solr-gsc server_id file_name.zip X.X`
 *    - where server_id is the outtput of `drush sapi-sl` also set in settings.local.php
 *    - where file_name.zip is the name of the config set zip file you will use. Usually name it solrX-X.zip where X-X is the solr version number.
 *    - where X.X is the solr version number - Get this from the production server if possible.
 *      This command will generate a zip file in the **web** directory that you need to put into the solr container.
 *    - Copy this file to the .docksal/etc/solr/solrX-X directory.
 *    - Adjust the mount definition in the .docksal/docksal-local.yml file to match the new directory that you just created.
 *    - Run `fin project reset` so that the new volume is created that contains your new config set.
 *
 *  - Replace "project_server_name" (in the below text ) with whatever your search server instance is called.
 *     Your server instance name is printed by executing `fin drush sapi-l`
 *
 *  - Adjust the -c, -d, and -n settings in the .docksal/commands/solr-core-create script to match your project.
 *
 *  - Run `fin solr-core-create` to create the new solr core that is referenced below.
 *     This creates a solr core that is specific to docksal and this version of solr. It is created from a
 *     generic configuration set mounted via the .docksal/docksal-local.yml file.
 *
 *  - If using acquia_search module then also set the override_search_core like this:
 *     (the acquia_search module has a README about this too)
 *

$config['acquia_search.settings']['override_search_core'] = 'projectCoreName';
$config['search_api.server.searchServerName'] = [
  'backend_config' => [
    'connector' => 'standard',
    'connector_config' => [
      'host' => 'solr',
      'path' => '/',
      'port' => '8983',
      'core' => 'projectCoreName',
    ],
  ],
];
*/

then in .docksal/docksal.yml

  # FOR ARM64 Support put this in a docksal-local.yml file
  # Solr 8.11
  #solr:
  #  image: arm64v8/solr:8
  #  extends:
  #    file: ${HOME}/.docksal/stacks/services.yml
  #    service: solr
  #  volumes:
  #    - ${PROJECT_ROOT}/.docksal/etc/solr/solr811:/opt/solr/server/solr/configsets/solr811
nsciacca-mg commented 7 months ago

Thank you @danshumaker - using your recipes above I was able to get it working, although I have to re-create the core every time the project loads. Small inconvenience for being able to perfectly match the destination server :) I used the solr:8.11 image as I didn't need the arm one.