Skip to content
This repository has been archived by the owner on Aug 6, 2022. It is now read-only.

How to use this repo with Drupal 7 #11

Closed
mccrodp opened this issue Feb 18, 2016 · 10 comments
Closed

How to use this repo with Drupal 7 #11

mccrodp opened this issue Feb 18, 2016 · 10 comments

Comments

@mccrodp
Copy link

mccrodp commented Feb 18, 2016

I saw this issue on Drupal #4 and wondering if it is possible to use this with the Drupal 7 module: https://www.drupal.org/project/apachesolr

It looks as though only 1.4 and 4.x versions are supported and I only see 5.x versions in this repo.

I was trying to get a docker-compose to integrate with your deprecated repo makuk66/docker-solr

solr:
  build: ../build/docker-solr
  ports:
    - "8983:8983"
  expose:
    - "8983"

Which points to the repo and Dockerfile here using this deprecated solr container:

FROM makuk66/docker-solr:4.10.4
MAINTAINER M Parker "mparker17@536298.no-reply.drupal.org"

ENV SOLR_VERSION solr-4.x

COPY apachesolr/solr-conf/$SOLR_VERSION/* /opt/$SOLR/example/solr/collection1/conf/

Anyway, I was getting a few errors when I build the machine which I posted on the associated repo: mparker17/docker-solr-apachesolr#1 and this made me wonder why official support for Drupal compatible Solr version seems unavailable. Thanks.

@mparker17
Copy link

@mccrodp I agree that an officially-supported Docker image with the Apache Solr Search module's structure, and also an officially-supported Docker image with the Search API Solr module's structure would be nice... as an unofficial maintainer for these Docker images, it would certainly save me some time, since I don't use these modules on every project, so I don't always update my images as fast as the upstream modules change.

However, this issue is filed in the queue for the Apache Solr software project itself (a generic search backend written in Java and used by many other pieces of software, two of which are Drupal's Apache Solr Search module, and Drupal's Search API Solr module)... I think the maintainers of those Drupal modules should be the ones providing the official support, not the maintainers of Apache Solr itself.

So you'd probably get better results by filing this feature request in those modules' issue queues instead:


Background...

Solr is a generic database backend, similar to how MySQL is a generic database backend, and, like MySQL, Solr needs to have a structure created on it before Drupal can use it. Unlike MySQL, however, setting up Solr's structure is a bit more complicated, because you have to save files in a special directory on the filesystem and restart the server (as opposed to MySQL where you can set up a structure by running CREATE TABLE statements and the new structure is available immediately). This means that the Apache Solr Search and Search API Solr modules cannot install / keep their own structures up-to-date the way that Drupal can with MySQL.

To make things more complicated, the Drupal ecosystem has a few different modules, mainly Apache Solr Search, and Search API Solr, each of which can allow Drupal to use Solr as it's search backend.

But the Solr structure that the Apache Solr Search module needs is incompatible with the Solr structure that the Search API Solr module needs, similar to the way that Backdrop and Drupal 8's MySQL database structures are incompatible.

Likewise, the data structure used by these modules changes with each version of the module, similar to how Drupal 7's database structure differs from Drupal 8's database structure.

@mccrodp
Copy link
Author

mccrodp commented Feb 19, 2016

Really appreciate this detailed response @mparker17, that really clarifies things from many angles.

Yes, it makes complete sense that the Apache Solr Drupal module maintainers are the ones pushing forward with integrations, but I guess if they had time they would be doing this also. I guess it's a similar case to the jQuery version being used in Drupal core, always a few steps behind to ensure compatibility. It is just unfortunate in this case that it blocks using the latest version and even this supported (generic) repo.

Drupal is gaining corporate momentum (which I guess is good and bad), so perhaps a company will come along and start being the official maintainers for something like this and they'll get to put their logo beside it 😉

Thanks for your work and help!

@makuk66
Copy link
Contributor

makuk66 commented Feb 24, 2016

@mparker17 said:

I think the maintainers of those Drupal modules should be the ones providing the official support

I agree. The docker-solr image is just a generic Solr distribution for Docker, with as little deviation from the upstream Apache Solr project as possible. We won't be adding consumer-specific extra configuration.

Consumers of Solr should where possible use the Solr APIs and commands to create their desired configuration, rather than rely on config and custom images, so they can treat Solr as a black box that is then easier to upgrade.

I see in Drupal Apache Solr Search module documentation that is uses config files; you might find this comment useful as an example of how to modify configuration.

Another option may be to create a shell script that makes the required modification and then invokes Solr -- then make that script available to the container with a volume, and execute it instead of the default solr command. That way you can docker run an unmodified docker-solr image that is configured for your use, and you won't need to use cp or exec. You should be able to do that with docker compose.

@mccrodp
Copy link
Author

mccrodp commented Feb 24, 2016

@makuk66 Thanks for this. While it is certainly helpful as a reference for myself for future it will also help others with more knowledge than me. My knowlege of Solr is somewhat limited, but growing, gradually.

I wonder is there potential for Drupal to interface directly with the Schema API then, perhaps in a Solr Schema API Drupal module, allowing for config through PHP or even a UI using a REST service or something to update the schema on the server Solr resides on. This may not be practical, but if it were, it could help the less Solr-savvy Drupal devs. I guess you'd have to be able to issue a restart of the Solr server from this UI then also, if so maybe it's not ideal in some ways.

@makuk66
Copy link
Contributor

makuk66 commented May 12, 2016

With the latest version of docker-solr you can now do something like:

docker run -P -i -v $PWD/apachesolr/solr-conf/solr-4.x:/myconfig solr solr-create -c drupalcore -d /myconfig

Alas that solr-4 config is not compatible with Solr 6, so you get error messages and no core. Fixing that config looks to be tracked upstream https://www.drupal.org/node/2453855 and https://www.drupal.org/node/2442077.
I tried the proposed https://www.drupal.org/project/1600962/git-instructions with:

docker run -P -d -v $PWD/other/apache_solr_common_configurations/conf/5.x/:/myconfig solr:5.3 solr-create -c mycore -d /myconfig

and that loaded. But I've not tried actually using it from Drupal container.

In any case, I don't think there's anything here to be done in docker-solr, so I'll close this bug.

@makuk66 makuk66 closed this as completed May 12, 2016
@gagarine
Copy link

@makuk66 how can you achieve that in a docker-compose file?

@makuk66
Copy link
Contributor

makuk66 commented Jul 22, 2016

Perhaps:

version: '2'
services:

  solr:
    image: docker-solr/docker-solr:5.3
    ports:
     - "8983:8983"
    volumes:
      - ./other/apache_solr_common_configurations/conf/5.x/:/myconfig
    entrypoint:
      - docker-entrypoint.sh
      - solr-create
      - -c
      - mycore
      - -d
      - /myconfig

@gagarine
Copy link

@makuk66 Thanks a lot. I think I'm still don't fully understand entrypoint, I will check this out.

@mparker17
Copy link

mparker17 commented Jul 25, 2016

@gagarine the differences between ENTRYPOINT and CMD are subtle (check out the documentation for the full picture).

Essentially, if you recall the syntax for the docker run command...

docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]

... using ENTRYPOINT lets you set the [COMMAND] part, meaning the syntax when running a image with an ENTRYPOINT becomes...

docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [ARG...]

... if you want to override the ENTRYPOINT, you have to pass the option --entrypoint=/path/to/new-cmd to docker run.


You might find it helpful to think of Dockerfiles without ENTRYPOINT lines as having a default ENTRYPOINT of /bin/sh -c. To use a simple example, docker run ubuntu:latest echo test is kind-of like running docker run ubuntu:latest /bin/sh -c 'echo test' (ubuntu:latest only has a CMD, not an ENTRYPOINT)

@gagarine
Copy link

@mparker17 I think I got it, I will adapt my configurations accordingly. Thanks for your help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants