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

Solr errors, Could not load conf for core drupal8 #1319

Closed
gitressa opened this Issue Nov 30, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@gitressa
Copy link

gitressa commented Nov 30, 2018

Bug Report

After installing a new site with Lando, the Solr core wasn't created.

Ubuntu 16.04
Lando v3.0.0-beta.47

My .lando.yml:

name: devsite
recipe: drupal8
config:
  webroot: web

# Get nice URLs for solr service.
proxy:
  search:
    - admin.devsite.lndo.site:8983

# Solr setup - see https://colorfield.be/blog/lando-configuration-solr7-drupal8-search-api-umami-profile
services:
  # Solr
  # Spin up a Solr container called "search".
  search:
    # Use a specific Solr version, same as the default one at the time of writing.
    type: solr:7.1
    # Optionally declare the name of the Solr core.
    # This setting is only applicable for versions 5.5 and above.
    core: drupal8
    # Optionally use custom Solr config files eg (schema.xml and solrconfig.xml).
    # This is relative to the app root (which may be different from your webroot).
    # This should be the directory containing the schema.xml and solrconfig.xml files, not the path to a certain file.
    config:
      conf: web/modules/contrib/search_api_solr/solr-conf/7.x

tooling:
  install-import:
    service: appserver
    description: "Build local dependencies, import config and run database updates"
    cmd: echo starting Drupal installation, config-import and other preparations

# Add in some custom event scripting
events:
  post-install-import:
    appserver: |
      cd $LANDO_WEBROOT # = cd /app/web, alternative: cd /app
      drush site-install --db-url=mysql://drupal8:drupal8@database/drupal8 --account-pass=admin --site-name=$LANDO_APP_NAME -y;

      # PRIVATE folder for uploaded files - set to safe permissions before launch
      chmod -R u+rw sites;

      # get UUID from base install with drush cget system.site uuid: 'system.site:uuid': 2be3702d-e362-44ea-940f-31x1aw2a4147
      drush cset system.site uuid 2be3702d-e362-44ea-940f-31x1aw2a4147 -y;

      # fix an error about shortcut_set, see: https://www.drupal.org/node/2583113
      drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();';

      # import configuration
      drush config-import --debug -y;

      ### TRUSTED HOST PATTERNS settings.php
      # insert trusted host pattern domains at the bottom of settings.php:
      echo "/* trusted hosts */\n\$settings['trusted_host_patterns'] = array( '^localhost\$', '^$LANDO_APP_NAME\.lndo.site\$', );" >> sites/default/settings.php

      ### DEVELOPMENT: Disable caching, see https://www.drupal.org/node/2598914
      cp sites/example.settings.local.php sites/default/settings.local.php;
      echo "/* enable debugging */
      \$settings['cache']['bins']['render'] = 'cache.backend.null';
      \$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
      \$settings['cache']['bins']['page'] = 'cache.backend.null';
      " >> sites/default/settings.local.php

      echo "/* enable debugging */
      if (file_exists(\$app_root . '/' . \$site_path . '/settings.local.php')) {
        include \$app_root . '/' . \$site_path . '/settings.local.php';
      }" >> sites/default/settings.php

      ### DEVELOPMENT: Set site URL for drush
      echo "DRUSH_OPTIONS_URI=http://$LANDO_APP_NAME.lndo.site" >> ../.env

      # one-time login for admin
      drush cron;
      drush uli /;

I was triggering the install and import by running lando install-import:

lando stop && lando destroy -y && lando start && lando install-import

The error I got in Solr:

drupal8: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core drupal8: Can't load schema /opt/solr/server/solr/mycores/drupal8/conf/schema.xml: Plugin init failure for [schema.xml] fieldType "collated": Error loading class 'solr.ICUCollationField'

In web/modules/contrib/search_api_solr/solr-conf/7.x/schema.xml I removed this:

  <fieldType name="collated" class="solr.ICUCollationField"
               locale="en"
               strength="primary"
               caseLevel="false" />

Got this error:

drupal8: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core drupal8: Can't load schema /opt/solr/server/solr/mycores/drupal8/conf/schema.xml: Unknown fieldType 'collated' specified on field sort_*

I removed this bit in web/modules/contrib/search_api_solr/solr-conf/7.x/schema.xml:

  <!-- Sortable version of the dynamic string field. We need to store it for streaming expressions. -->
  <dynamicField name="sort_*" type="collated" indexed="false" stored="false" docValues="true"/>

There are no errors now, and the drupal8 Solr core is created. Search doesn't work, but at least the reason for core not getting created is found, and what remains is to fix the issue :-)

@gitressa

This comment has been minimized.

Copy link
Author

gitressa commented Dec 1, 2018

I solved it by updating solr.install.dir=../../.. to solr.install.dir=/opt/solr in solrcore.properties right before starting Lando:

sed -i -e 's|../../..|/opt/solr|g' web/modules/contrib/search_api_solr/solr-conf/7.x/solrcore.properties
lando stop && lando destroy -y && lando start && lando install-import && ready

@gitressa

This comment has been minimized.

Copy link
Author

gitressa commented Dec 3, 2018

Just deleting the line solr.install.dir=../../.. also works.

@pirog pirog added this to the 3.0.0-rc.2 milestone Jan 28, 2019

@pirog pirog self-assigned this Jan 28, 2019

pirog added a commit that referenced this issue Jan 29, 2019

pirog added a commit that referenced this issue Jan 29, 2019

@pirog pirog closed this Jan 29, 2019

pirog added a commit that referenced this issue Jan 29, 2019

pirog added a commit that referenced this issue Jan 30, 2019

pirog added a commit that referenced this issue Jan 30, 2019

pirog added a commit that referenced this issue Jan 30, 2019

pirog added a commit that referenced this issue Jan 30, 2019

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 30, 2019

We've got some nice tests and an example to verify this now.
https://github.com/lando/lando/tree/master/examples/solr

Note that these examples and tests are against RC2 which is yet to be released so its worth waiting for that before you verify on your own

@hanoii

This comment has been minimized.

Copy link
Contributor

hanoii commented Jan 31, 2019

for what it's worth, I just tried master with solr 7.6 and the default conf from the latest search_api_solr 3.0-alpha2 and it doesn't seem to work, still getting:

drupal: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core drupal: Can't load schema /opt/solr/server/solr/mycores/drupal/conf/schema.xml: Unknown fieldType 'text_und' specified on field tus_*

name: solr

proxy:
  # Lets get a nice lndo url for the solr web interface
  solrsearch:
    - solr.lndo.site:8983

# Spin up services to run a basic LAMP stack
services:
  solrsearch:
    type: solr:7.6
    portforward: true
    core: drupal
    config:
      dir: .platform/solr-conf
`
@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 31, 2019

@hanoii

This comment has been minimized.

Copy link
Contributor

hanoii commented Jan 31, 2019

It's search_api_solr and they say is stable-ish, and it's just the schema so I expected it to work, but I tried the latest stable 2.5 config and it did work.

@hanoii

This comment has been minimized.

Copy link
Contributor

hanoii commented Jan 31, 2019

If I may ask something though - I see you are modifying solrcore.properties. I am keeping the solr config under version control as something I have the need of tweaking it, however I shouldn't be committing this change upstream. I see on https://github.com/lando/lando/tree/master/examples/solr that you imply to copy the .old to restore original, is it like that?

From https://www.drupal.org/project/search_api_solr/issues/3015993 the patch that was just committed implied that there's a way to pass solr.install.dir as a jvm option, so maybe that's a better alternative to do it within the container than modifying the file?

Thanks

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment